Update qmlobserver with latest qmlviewer patches
Update qmlobserver with changes in qmlviewer until 376e636eccedb8d8bb.
@@ -14,5 +14,36 @@
|
|||||||
<string>@TYPEINFO@</string>
|
<string>@TYPEINFO@</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>@EXECUTABLE@</string>
|
<string>@EXECUTABLE@</string>
|
||||||
|
<key>UTExportedTypeDeclarations</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>UTTypeIdentifier</key>
|
||||||
|
<string>com.nokia.qt.qml</string>
|
||||||
|
<key>UTTypeDescription</key>
|
||||||
|
<string>Qt Markup Language</string>
|
||||||
|
<key>UTTypeConformsTo</key>
|
||||||
|
<array>
|
||||||
|
<string>public.plain-text</string>
|
||||||
|
</array>
|
||||||
|
<key>UTTypeTagSpecification</key>
|
||||||
|
<dict>
|
||||||
|
<key>public.filename-extension</key>
|
||||||
|
<array>
|
||||||
|
<string>qml</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleDocumentTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>LSItemContentTypes</key>
|
||||||
|
<array>
|
||||||
|
<string>com.nokia.qt.qml</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -39,12 +39,12 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
import Qt 4.7
|
import QtQuick 1.0
|
||||||
import Qt.labs.folderlistmodel 1.0
|
import Qt.labs.folderlistmodel 1.0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
property bool keyPressed: false
|
property bool showFocusHighlight: false
|
||||||
property variant folders: folders1
|
property variant folders: folders1
|
||||||
property variant view: view1
|
property variant view: view1
|
||||||
width: 320
|
width: 320
|
||||||
@@ -95,6 +95,19 @@ Rectangle {
|
|||||||
view.focus = true;
|
view.focus = true;
|
||||||
folders.folder = path;
|
folders.folder = path;
|
||||||
}
|
}
|
||||||
|
function keyPressed(key) {
|
||||||
|
switch (key) {
|
||||||
|
case Qt.Key_Up:
|
||||||
|
case Qt.Key_Down:
|
||||||
|
case Qt.Key_Left:
|
||||||
|
case Qt.Key_Right:
|
||||||
|
root.showFocusHighlight = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// do nothing
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: folderDelegate
|
id: folderDelegate
|
||||||
@@ -113,6 +126,7 @@ Rectangle {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
id: highlight; visible: false
|
id: highlight; visible: false
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
color: palette.highlight
|
||||||
gradient: Gradient {
|
gradient: Gradient {
|
||||||
GradientStop { id: t1; position: 0.0; color: palette.highlight }
|
GradientStop { id: t1; position: 0.0; color: palette.highlight }
|
||||||
GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) }
|
GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) }
|
||||||
@@ -128,12 +142,16 @@ Rectangle {
|
|||||||
text: fileName
|
text: fileName
|
||||||
anchors.leftMargin: 54
|
anchors.leftMargin: 54
|
||||||
font.pixelSize: 32
|
font.pixelSize: 32
|
||||||
color: (wrapper.ListView.isCurrentItem && root.keyPressed) ? palette.highlightedText : palette.windowText
|
color: (wrapper.ListView.isCurrentItem && root.showFocusHighlight) ? palette.highlightedText : palette.windowText
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseRegion
|
id: mouseRegion
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
onPressed: {
|
||||||
|
root.showFocusHighlight = false;
|
||||||
|
wrapper.ListView.view.currentIndex = index;
|
||||||
|
}
|
||||||
onClicked: { if (folders == wrapper.ListView.view.model) launch() }
|
onClicked: { if (folders == wrapper.ListView.view.model) launch() }
|
||||||
}
|
}
|
||||||
states: [
|
states: [
|
||||||
@@ -155,7 +173,15 @@ Rectangle {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
model: folders1
|
model: folders1
|
||||||
delegate: folderDelegate
|
delegate: folderDelegate
|
||||||
highlight: Rectangle { color: palette.highlight; visible: root.keyPressed && view1.count != 0 }
|
highlight: Rectangle {
|
||||||
|
color: palette.highlight
|
||||||
|
visible: root.showFocusHighlight && view1.count != 0
|
||||||
|
gradient: Gradient {
|
||||||
|
GradientStop { id: t1; position: 0.0; color: palette.highlight }
|
||||||
|
GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) }
|
||||||
|
}
|
||||||
|
width: view1.currentItem == null ? 0 : view1.currentItem.width
|
||||||
|
}
|
||||||
highlightMoveSpeed: 1000
|
highlightMoveSpeed: 1000
|
||||||
pressDelay: 100
|
pressDelay: 100
|
||||||
focus: true
|
focus: true
|
||||||
@@ -186,7 +212,7 @@ Rectangle {
|
|||||||
NumberAnimation { properties: "x"; duration: 250 }
|
NumberAnimation { properties: "x"; duration: 250 }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
Keys.onPressed: { root.keyPressed = true; }
|
Keys.onPressed: root.keyPressed(event.key)
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
@@ -197,7 +223,15 @@ Rectangle {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
model: folders2
|
model: folders2
|
||||||
delegate: folderDelegate
|
delegate: folderDelegate
|
||||||
highlight: Rectangle { color: palette.highlight; visible: root.keyPressed && view2.count != 0 }
|
highlight: Rectangle {
|
||||||
|
color: palette.highlight
|
||||||
|
visible: root.showFocusHighlight && view2.count != 0
|
||||||
|
gradient: Gradient {
|
||||||
|
GradientStop { id: t1; position: 0.0; color: palette.highlight }
|
||||||
|
GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) }
|
||||||
|
}
|
||||||
|
width: view1.currentItem == null ? 0 : view1.currentItem.width
|
||||||
|
}
|
||||||
highlightMoveSpeed: 1000
|
highlightMoveSpeed: 1000
|
||||||
pressDelay: 100
|
pressDelay: 100
|
||||||
states: [
|
states: [
|
||||||
@@ -225,11 +259,11 @@ Rectangle {
|
|||||||
NumberAnimation { properties: "x"; duration: 250 }
|
NumberAnimation { properties: "x"; duration: 250 }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
Keys.onPressed: { root.keyPressed = true; }
|
Keys.onPressed: root.keyPressed(event.key)
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onPressed: {
|
Keys.onPressed: {
|
||||||
root.keyPressed = true;
|
root.keyPressed(event.key);
|
||||||
if (event.key == Qt.Key_Return || event.key == Qt.Key_Select || event.key == Qt.Key_Right) {
|
if (event.key == Qt.Key_Return || event.key == Qt.Key_Select || event.key == Qt.Key_Right) {
|
||||||
view.currentItem.launch();
|
view.currentItem.launch();
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
9
share/qtcreator/qml/qmlobserver/browser/browser.qrc
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/browser">
|
||||||
|
<file>Browser.qml</file>
|
||||||
|
<file>images/up.png</file>
|
||||||
|
<file>images/folder.png</file>
|
||||||
|
<file>images/titlebar.sci</file>
|
||||||
|
<file>images/titlebar.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 662 B After Width: | Height: | Size: 662 B |
@@ -53,6 +53,11 @@ public:
|
|||||||
return m_orientation;
|
return m_orientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pauseListening() {
|
||||||
|
}
|
||||||
|
void resumeListening() {
|
||||||
|
}
|
||||||
|
|
||||||
void setOrientation(Orientation o) {
|
void setOrientation(Orientation o) {
|
||||||
if (o != m_orientation) {
|
if (o != m_orientation) {
|
||||||
m_orientation = o;
|
m_orientation = o;
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ public:
|
|||||||
virtual Orientation orientation() const = 0;
|
virtual Orientation orientation() const = 0;
|
||||||
virtual void setOrientation(Orientation) = 0;
|
virtual void setOrientation(Orientation) = 0;
|
||||||
|
|
||||||
|
virtual void pauseListening() = 0;
|
||||||
|
virtual void resumeListening() = 0;
|
||||||
|
|
||||||
static DeviceOrientation *instance();
|
static DeviceOrientation *instance();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
161
share/qtcreator/qml/qmlobserver/deviceorientation_harmattan.cpp
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 <QtDBus>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#define ORIENTATION_SERVICE "com.nokia.SensorService"
|
||||||
|
#define ORIENTATION_PATH "/org/maemo/contextkit/Screen/TopEdge"
|
||||||
|
#define CONTEXT_INTERFACE "org.maemo.contextkit.Property"
|
||||||
|
#define CONTEXT_CHANGED "ValueChanged"
|
||||||
|
#define CONTEXT_SUBSCRIBE "Subscribe"
|
||||||
|
#define CONTEXT_UNSUBSCRIBE "Unsubscribe"
|
||||||
|
#define CONTEXT_GET "Get"
|
||||||
|
|
||||||
|
|
||||||
|
class HarmattanOrientation : public DeviceOrientation
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
HarmattanOrientation()
|
||||||
|
: o(UnknownOrientation), sensorEnabled(false)
|
||||||
|
{
|
||||||
|
resumeListening();
|
||||||
|
// connect to the orientation change signal
|
||||||
|
bool ok = QDBusConnection::systemBus().connect(ORIENTATION_SERVICE, ORIENTATION_PATH,
|
||||||
|
CONTEXT_INTERFACE,
|
||||||
|
CONTEXT_CHANGED,
|
||||||
|
this,
|
||||||
|
SLOT(deviceOrientationChanged(QList<QVariant>,quint64)));
|
||||||
|
// qDebug() << "connection OK" << ok;
|
||||||
|
QDBusMessage reply = QDBusConnection::systemBus().call(
|
||||||
|
QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH,
|
||||||
|
CONTEXT_INTERFACE, CONTEXT_GET));
|
||||||
|
if (reply.type() != QDBusMessage::ErrorMessage) {
|
||||||
|
QList<QVariant> args;
|
||||||
|
qvariant_cast<QDBusArgument>(reply.arguments().at(0)) >> args;
|
||||||
|
deviceOrientationChanged(args, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
~HarmattanOrientation()
|
||||||
|
{
|
||||||
|
// unsubscribe from the orientation sensor
|
||||||
|
if (sensorEnabled)
|
||||||
|
QDBusConnection::systemBus().call(
|
||||||
|
QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH,
|
||||||
|
CONTEXT_INTERFACE, CONTEXT_UNSUBSCRIBE));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Orientation orientation() const
|
||||||
|
{
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setOrientation(Orientation)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void pauseListening() {
|
||||||
|
if (sensorEnabled) {
|
||||||
|
// unsubscribe from the orientation sensor
|
||||||
|
QDBusConnection::systemBus().call(
|
||||||
|
QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH,
|
||||||
|
CONTEXT_INTERFACE, CONTEXT_UNSUBSCRIBE));
|
||||||
|
sensorEnabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void resumeListening() {
|
||||||
|
if (!sensorEnabled) {
|
||||||
|
// subscribe to the orientation sensor
|
||||||
|
QDBusMessage reply = QDBusConnection::systemBus().call(
|
||||||
|
QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH,
|
||||||
|
CONTEXT_INTERFACE, CONTEXT_SUBSCRIBE));
|
||||||
|
|
||||||
|
if (reply.type() == QDBusMessage::ErrorMessage) {
|
||||||
|
qWarning("Unable to retrieve device orientation: %s", qPrintable(reply.errorMessage()));
|
||||||
|
} else {
|
||||||
|
sensorEnabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void deviceOrientationChanged(QList<QVariant> args,quint64)
|
||||||
|
{
|
||||||
|
if (args.count() == 0)
|
||||||
|
return;
|
||||||
|
Orientation newOrientation = toOrientation(args.at(0).toString());
|
||||||
|
if (newOrientation != o) {
|
||||||
|
o = newOrientation;
|
||||||
|
emit orientationChanged();
|
||||||
|
}
|
||||||
|
// qDebug() << "orientation" << args.at(0).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static Orientation toOrientation(const QString &nativeOrientation)
|
||||||
|
{
|
||||||
|
if (nativeOrientation == "top")
|
||||||
|
return Landscape;
|
||||||
|
else if (nativeOrientation == "left")
|
||||||
|
return Portrait;
|
||||||
|
else if (nativeOrientation == "bottom")
|
||||||
|
return LandscapeInverted;
|
||||||
|
else if (nativeOrientation == "right")
|
||||||
|
return PortraitInverted;
|
||||||
|
return UnknownOrientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Orientation o;
|
||||||
|
bool sensorEnabled;
|
||||||
|
};
|
||||||
|
|
||||||
|
DeviceOrientation* DeviceOrientation::instance()
|
||||||
|
{
|
||||||
|
static HarmattanOrientation *o = new HarmattanOrientation;
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "deviceorientation_harmattan.moc"
|
||||||
@@ -50,23 +50,9 @@ class MaemoOrientation : public DeviceOrientation
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MaemoOrientation()
|
MaemoOrientation()
|
||||||
: o(UnknownOrientation)
|
: o(UnknownOrientation), sensorEnabled(false)
|
||||||
{
|
{
|
||||||
// enable the orientation sensor
|
resumeListening();
|
||||||
QDBusConnection::systemBus().call(
|
|
||||||
QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH,
|
|
||||||
MCE_REQUEST_IF, MCE_ACCELEROMETER_ENABLE_REQ));
|
|
||||||
|
|
||||||
// query the initial orientation
|
|
||||||
QDBusMessage reply = QDBusConnection::systemBus().call(
|
|
||||||
QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH,
|
|
||||||
MCE_REQUEST_IF, MCE_DEVICE_ORIENTATION_GET));
|
|
||||||
if (reply.type() == QDBusMessage::ErrorMessage) {
|
|
||||||
qWarning("Unable to retrieve device orientation: %s", qPrintable(reply.errorMessage()));
|
|
||||||
} else {
|
|
||||||
o = toOrientation(reply.arguments().value(0).toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
// connect to the orientation change signal
|
// connect to the orientation change signal
|
||||||
QDBusConnection::systemBus().connect(QString(), MCE_SIGNAL_PATH, MCE_SIGNAL_IF,
|
QDBusConnection::systemBus().connect(QString(), MCE_SIGNAL_PATH, MCE_SIGNAL_IF,
|
||||||
MCE_DEVICE_ORIENTATION_SIG,
|
MCE_DEVICE_ORIENTATION_SIG,
|
||||||
@@ -91,6 +77,40 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pauseListening() {
|
||||||
|
if (sensorEnabled) {
|
||||||
|
// disable the orientation sensor
|
||||||
|
QDBusConnection::systemBus().call(
|
||||||
|
QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH,
|
||||||
|
MCE_REQUEST_IF, MCE_ACCELEROMETER_DISABLE_REQ));
|
||||||
|
sensorEnabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void resumeListening() {
|
||||||
|
if (!sensorEnabled) {
|
||||||
|
// enable the orientation sensor
|
||||||
|
QDBusConnection::systemBus().call(
|
||||||
|
QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH,
|
||||||
|
MCE_REQUEST_IF, MCE_ACCELEROMETER_ENABLE_REQ));
|
||||||
|
|
||||||
|
QDBusMessage reply = QDBusConnection::systemBus().call(
|
||||||
|
QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH,
|
||||||
|
MCE_REQUEST_IF, MCE_DEVICE_ORIENTATION_GET));
|
||||||
|
|
||||||
|
if (reply.type() == QDBusMessage::ErrorMessage) {
|
||||||
|
qWarning("Unable to retrieve device orientation: %s", qPrintable(reply.errorMessage()));
|
||||||
|
} else {
|
||||||
|
Orientation orientation = toOrientation(reply.arguments().value(0).toString());
|
||||||
|
if (o != orientation) {
|
||||||
|
o = orientation;
|
||||||
|
emit orientationChanged();
|
||||||
|
}
|
||||||
|
sensorEnabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void deviceOrientationChanged(const QString &newOrientation)
|
void deviceOrientationChanged(const QString &newOrientation)
|
||||||
{
|
{
|
||||||
@@ -116,6 +136,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Orientation o;
|
Orientation o;
|
||||||
|
bool sensorEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
DeviceOrientation* DeviceOrientation::instance()
|
DeviceOrientation* DeviceOrientation::instance()
|
||||||
|
|||||||
192
share/qtcreator/qml/qmlobserver/deviceorientation_symbian.cpp
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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), m_channelOpen(false)
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
m_channelOpen = true;
|
||||||
|
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;
|
||||||
|
bool m_channelOpen;
|
||||||
|
void pauseListening() {
|
||||||
|
if (m_sensorChannel && m_channelOpen) {
|
||||||
|
m_sensorChannel->StopDataListening();
|
||||||
|
m_sensorChannel->CloseChannel();
|
||||||
|
m_channelOpen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void resumeListening() {
|
||||||
|
if (m_sensorChannel && !m_channelOpen) {
|
||||||
|
TRAPD(error, m_sensorChannel->OpenChannelL());
|
||||||
|
if (!error) {
|
||||||
|
TRAP(error, m_sensorChannel->StartDataListeningL(this, 1, 1, 0));
|
||||||
|
if (!error) {
|
||||||
|
m_channelOpen = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (error) {
|
||||||
|
delete m_sensorChannel;
|
||||||
|
m_sensorChannel = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataReceived(CSensrvChannel &channel, TInt count, TInt dataLost)
|
||||||
|
{
|
||||||
|
Q_UNUSED(dataLost)
|
||||||
|
if (channel.GetChannelInfo().iChannelType == KSensrvChannelTypeIdOrientationData) {
|
||||||
|
TSensrvOrientationData data;
|
||||||
|
for (int i = 0; i < count; ++i) {
|
||||||
|
TPckgBuf<TSensrvOrientationData> dataBuf;
|
||||||
|
channel.GetData(dataBuf);
|
||||||
|
data = dataBuf();
|
||||||
|
Orientation orientation = UnknownOrientation;
|
||||||
|
switch (data.iDeviceOrientation) {
|
||||||
|
case TSensrvOrientationData::EOrientationDisplayUp:
|
||||||
|
orientation = Portrait;
|
||||||
|
break;
|
||||||
|
case TSensrvOrientationData::EOrientationDisplayRightUp:
|
||||||
|
orientation = Landscape;
|
||||||
|
break;
|
||||||
|
case TSensrvOrientationData::EOrientationDisplayLeftUp:
|
||||||
|
orientation = LandscapeInverted;
|
||||||
|
break;
|
||||||
|
case TSensrvOrientationData::EOrientationDisplayDown:
|
||||||
|
orientation = PortraitInverted;
|
||||||
|
break;
|
||||||
|
case TSensrvOrientationData::EOrientationUndefined:
|
||||||
|
case TSensrvOrientationData::EOrientationDisplayUpwards:
|
||||||
|
case TSensrvOrientationData::EOrientationDisplayDownwards:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_current != orientation && orientation != UnknownOrientation) {
|
||||||
|
m_current = orientation;
|
||||||
|
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"
|
||||||
@@ -49,6 +49,7 @@
|
|||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QAtomicInt>
|
||||||
#include "qdeclarativetester.h"
|
#include "qdeclarativetester.h"
|
||||||
#include "qt_private/qdeclarativedebughelper_p.h"
|
#include "qt_private/qdeclarativedebughelper_p.h"
|
||||||
|
|
||||||
@@ -56,6 +57,9 @@ QT_USE_NAMESPACE
|
|||||||
|
|
||||||
QtMsgHandler systemMsgOutput = 0;
|
QtMsgHandler systemMsgOutput = 0;
|
||||||
|
|
||||||
|
static QDeclarativeViewer *openFile(const QString &fileName);
|
||||||
|
static void showViewer(QDeclarativeViewer *viewer);
|
||||||
|
|
||||||
#if defined (Q_OS_SYMBIAN)
|
#if defined (Q_OS_SYMBIAN)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -83,25 +87,35 @@ void myMessageOutput(QtMsgType type, const char *msg)
|
|||||||
QWeakPointer<LoggerWidget> logger;
|
QWeakPointer<LoggerWidget> logger;
|
||||||
|
|
||||||
QString warnings;
|
QString warnings;
|
||||||
void showWarnings()
|
void exitApp(int i)
|
||||||
{
|
{
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
// Debugging output is not visible by default on Windows -
|
||||||
|
// therefore show modal dialog with errors instead.
|
||||||
if (!warnings.isEmpty()) {
|
if (!warnings.isEmpty()) {
|
||||||
int argc = 0; char **argv = 0;
|
|
||||||
QApplication application(argc, argv); // QApplication() in main has been destroyed already.
|
|
||||||
Q_UNUSED(application)
|
|
||||||
QMessageBox::warning(0, QApplication::tr("Qt QML Viewer"), warnings);
|
QMessageBox::warning(0, QApplication::tr("Qt QML Viewer"), warnings);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
exit(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QAtomicInt recursiveLock(0);
|
||||||
|
|
||||||
void myMessageOutput(QtMsgType type, const char *msg)
|
void myMessageOutput(QtMsgType type, const char *msg)
|
||||||
{
|
{
|
||||||
|
QString strMsg = QString::fromLatin1(msg);
|
||||||
|
|
||||||
|
if (!QCoreApplication::closingDown()) {
|
||||||
if (!logger.isNull()) {
|
if (!logger.isNull()) {
|
||||||
QString strMsg = QString::fromAscii(msg);
|
if (recursiveLock.testAndSetOrdered(0, 1)) {
|
||||||
QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg));
|
QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg));
|
||||||
|
recursiveLock = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
warnings += msg;
|
warnings += strMsg;
|
||||||
warnings += QLatin1Char('\n');
|
warnings += QLatin1Char('\n');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (systemMsgOutput) { // Windows
|
if (systemMsgOutput) { // Windows
|
||||||
systemMsgOutput(type, msg);
|
systemMsgOutput(type, msg);
|
||||||
} else { // Unix
|
} else { // Unix
|
||||||
@@ -112,6 +126,11 @@ void myMessageOutput(QtMsgType type, const char *msg)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static QDeclarativeViewer* globalViewer = 0;
|
||||||
|
|
||||||
|
// The qml file that is shown if the user didn't specify a QML file
|
||||||
|
QString initialFile = "qrc:/startup/startup.qml";
|
||||||
|
|
||||||
void usage()
|
void usage()
|
||||||
{
|
{
|
||||||
qWarning("Usage: qmlobserver [options] <filename>");
|
qWarning("Usage: qmlobserver [options] <filename>");
|
||||||
@@ -143,7 +162,11 @@ void usage()
|
|||||||
qWarning(" -I <directory> ........................... prepend to the module import search path,");
|
qWarning(" -I <directory> ........................... prepend to the module import search path,");
|
||||||
qWarning(" display path if <directory> is empty");
|
qWarning(" display path if <directory> is empty");
|
||||||
qWarning(" -P <directory> ........................... prepend to the plugin search path");
|
qWarning(" -P <directory> ........................... prepend to the plugin search path");
|
||||||
|
#if defined(Q_WS_MAC)
|
||||||
|
qWarning(" -no-opengl ............................... don't use a QGLWidget for the viewport");
|
||||||
|
#else
|
||||||
qWarning(" -opengl .................................. use a QGLWidget for the viewport");
|
qWarning(" -opengl .................................. use a QGLWidget for the viewport");
|
||||||
|
#endif
|
||||||
#ifndef NO_PRIVATE_HEADERS
|
#ifndef NO_PRIVATE_HEADERS
|
||||||
qWarning(" -script <path> ........................... set the script to use");
|
qWarning(" -script <path> ........................... set the script to use");
|
||||||
qWarning(" -scriptopts <options>|help ............... set the script options to use");
|
qWarning(" -scriptopts <options>|help ............... set the script options to use");
|
||||||
@@ -151,7 +174,8 @@ void usage()
|
|||||||
|
|
||||||
qWarning(" ");
|
qWarning(" ");
|
||||||
qWarning(" Press F1 for interactive help");
|
qWarning(" Press F1 for interactive help");
|
||||||
exit(1);
|
|
||||||
|
exitApp(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void scriptOptsUsage()
|
void scriptOptsUsage()
|
||||||
@@ -162,6 +186,7 @@ void scriptOptsUsage()
|
|||||||
qWarning(" play ..................................... playback an existing script");
|
qWarning(" play ..................................... playback an existing script");
|
||||||
qWarning(" testimages ............................... record images or compare images on playback");
|
qWarning(" testimages ............................... record images or compare images on playback");
|
||||||
qWarning(" testerror ................................ test 'error' property of root item on playback");
|
qWarning(" testerror ................................ test 'error' property of root item on playback");
|
||||||
|
qWarning(" testskip ................................ test 'skip' property of root item on playback");
|
||||||
qWarning(" snapshot ................................. file being recorded is static,");
|
qWarning(" snapshot ................................. file being recorded is static,");
|
||||||
qWarning(" only one frame will be recorded or tested");
|
qWarning(" only one frame will be recorded or tested");
|
||||||
qWarning(" exitoncomplete ........................... cleanly exit the viewer on script completion");
|
qWarning(" exitoncomplete ........................... cleanly exit the viewer on script completion");
|
||||||
@@ -169,11 +194,344 @@ void scriptOptsUsage()
|
|||||||
qWarning(" saveonexit ............................... save recording on viewer exit");
|
qWarning(" saveonexit ............................... save recording on viewer exit");
|
||||||
qWarning(" ");
|
qWarning(" ");
|
||||||
qWarning(" One of record, play or both must be specified.");
|
qWarning(" One of record, play or both must be specified.");
|
||||||
exit(1);
|
|
||||||
|
exitApp(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum WarningsConfig { ShowWarnings, HideWarnings, DefaultWarnings };
|
enum WarningsConfig { ShowWarnings, HideWarnings, DefaultWarnings };
|
||||||
|
|
||||||
|
struct ViewerOptions
|
||||||
|
{
|
||||||
|
ViewerOptions()
|
||||||
|
: frameless(false),
|
||||||
|
fps(0.0),
|
||||||
|
autorecord_from(0),
|
||||||
|
autorecord_to(0),
|
||||||
|
dither("none"),
|
||||||
|
runScript(false),
|
||||||
|
devkeys(false),
|
||||||
|
cache(0),
|
||||||
|
useGL(false),
|
||||||
|
fullScreen(false),
|
||||||
|
stayOnTop(false),
|
||||||
|
maximized(false),
|
||||||
|
useNativeFileBrowser(true),
|
||||||
|
experimentalGestures(false),
|
||||||
|
warningsConfig(DefaultWarnings),
|
||||||
|
sizeToView(true)
|
||||||
|
{
|
||||||
|
#if defined(Q_OS_SYMBIAN)
|
||||||
|
maximized = true;
|
||||||
|
useNativeFileBrowser = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(Q_WS_MAC)
|
||||||
|
useGL = true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool frameless;
|
||||||
|
double fps;
|
||||||
|
int autorecord_from;
|
||||||
|
int autorecord_to;
|
||||||
|
QString dither;
|
||||||
|
QString recordfile;
|
||||||
|
QStringList recordargs;
|
||||||
|
QStringList imports;
|
||||||
|
QStringList plugins;
|
||||||
|
QString script;
|
||||||
|
QString scriptopts;
|
||||||
|
bool runScript;
|
||||||
|
bool devkeys;
|
||||||
|
int cache;
|
||||||
|
QString translationFile;
|
||||||
|
bool useGL;
|
||||||
|
bool fullScreen;
|
||||||
|
bool stayOnTop;
|
||||||
|
bool maximized;
|
||||||
|
bool useNativeFileBrowser;
|
||||||
|
bool experimentalGestures;
|
||||||
|
|
||||||
|
WarningsConfig warningsConfig;
|
||||||
|
bool sizeToView;
|
||||||
|
|
||||||
|
QDeclarativeViewer::ScriptOptions scriptOptions;
|
||||||
|
};
|
||||||
|
|
||||||
|
static ViewerOptions opts;
|
||||||
|
static QStringList fileNames;
|
||||||
|
|
||||||
|
class Application : public QApplication
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
Application(int &argc, char **&argv)
|
||||||
|
: QApplication(argc, argv)
|
||||||
|
{}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool event(QEvent *ev)
|
||||||
|
{
|
||||||
|
if (ev->type() != QEvent::FileOpen)
|
||||||
|
return QApplication::event(ev);
|
||||||
|
|
||||||
|
QFileOpenEvent *fev = static_cast<QFileOpenEvent *>(ev);
|
||||||
|
|
||||||
|
globalViewer->open(fev->file());
|
||||||
|
if (!globalViewer->isVisible())
|
||||||
|
showViewer(globalViewer);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void showInitialViewer()
|
||||||
|
{
|
||||||
|
QApplication::processEvents();
|
||||||
|
|
||||||
|
QDeclarativeViewer *viewer = globalViewer;
|
||||||
|
if (!viewer)
|
||||||
|
return;
|
||||||
|
if (viewer->currentFile().isEmpty()) {
|
||||||
|
if(opts.useNativeFileBrowser)
|
||||||
|
viewer->open(initialFile);
|
||||||
|
else
|
||||||
|
viewer->openFile();
|
||||||
|
}
|
||||||
|
if (!viewer->isVisible())
|
||||||
|
showViewer(viewer);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static void parseScriptOptions()
|
||||||
|
{
|
||||||
|
QStringList options =
|
||||||
|
opts.scriptopts.split(QLatin1Char(','), QString::SkipEmptyParts);
|
||||||
|
|
||||||
|
QDeclarativeViewer::ScriptOptions scriptOptions = 0;
|
||||||
|
for (int i = 0; i < options.count(); ++i) {
|
||||||
|
const QString &option = options.at(i);
|
||||||
|
if (option == QLatin1String("help")) {
|
||||||
|
scriptOptsUsage();
|
||||||
|
} else if (option == QLatin1String("play")) {
|
||||||
|
scriptOptions |= QDeclarativeViewer::Play;
|
||||||
|
} else if (option == QLatin1String("record")) {
|
||||||
|
scriptOptions |= QDeclarativeViewer::Record;
|
||||||
|
} else if (option == QLatin1String("testimages")) {
|
||||||
|
scriptOptions |= QDeclarativeViewer::TestImages;
|
||||||
|
} else if (option == QLatin1String("testerror")) {
|
||||||
|
scriptOptions |= QDeclarativeViewer::TestErrorProperty;
|
||||||
|
} else if (option == QLatin1String("testskip")) {
|
||||||
|
scriptOptions |= QDeclarativeViewer::TestSkipProperty;
|
||||||
|
} else if (option == QLatin1String("exitoncomplete")) {
|
||||||
|
scriptOptions |= QDeclarativeViewer::ExitOnComplete;
|
||||||
|
} else if (option == QLatin1String("exitonfailure")) {
|
||||||
|
scriptOptions |= QDeclarativeViewer::ExitOnFailure;
|
||||||
|
} else if (option == QLatin1String("saveonexit")) {
|
||||||
|
scriptOptions |= QDeclarativeViewer::SaveOnExit;
|
||||||
|
} else if (option == QLatin1String("snapshot")) {
|
||||||
|
scriptOptions |= QDeclarativeViewer::Snapshot;
|
||||||
|
} else {
|
||||||
|
scriptOptsUsage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
opts.scriptOptions = scriptOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void parseCommandLineOptions(const QStringList &arguments)
|
||||||
|
{
|
||||||
|
for (int i = 1; i < arguments.count(); ++i) {
|
||||||
|
bool lastArg = (i == arguments.count() - 1);
|
||||||
|
QString arg = arguments.at(i);
|
||||||
|
if (arg == "-frameless") {
|
||||||
|
opts.frameless = true;
|
||||||
|
} else if (arg == "-maximized") {
|
||||||
|
opts.maximized = true;
|
||||||
|
} else if (arg == "-fullscreen") {
|
||||||
|
opts.fullScreen = true;
|
||||||
|
} else if (arg == "-stayontop") {
|
||||||
|
opts.stayOnTop = true;
|
||||||
|
} else if (arg == "-netcache") {
|
||||||
|
if (lastArg) usage();
|
||||||
|
opts.cache = arguments.at(++i).toInt();
|
||||||
|
} else if (arg == "-recordrate") {
|
||||||
|
if (lastArg) usage();
|
||||||
|
opts.fps = arguments.at(++i).toDouble();
|
||||||
|
} else if (arg == "-recordfile") {
|
||||||
|
if (lastArg) usage();
|
||||||
|
opts.recordfile = arguments.at(++i);
|
||||||
|
} else if (arg == "-record") {
|
||||||
|
if (lastArg) usage();
|
||||||
|
opts.recordargs << arguments.at(++i);
|
||||||
|
} else if (arg == "-recorddither") {
|
||||||
|
if (lastArg) usage();
|
||||||
|
opts.dither = arguments.at(++i);
|
||||||
|
} else if (arg == "-autorecord") {
|
||||||
|
if (lastArg) usage();
|
||||||
|
QString range = arguments.at(++i);
|
||||||
|
int dash = range.indexOf('-');
|
||||||
|
if (dash > 0)
|
||||||
|
opts.autorecord_from = range.left(dash).toInt();
|
||||||
|
opts.autorecord_to = range.mid(dash+1).toInt();
|
||||||
|
} else if (arg == "-devicekeys") {
|
||||||
|
opts.devkeys = true;
|
||||||
|
} else if (arg == "-dragthreshold") {
|
||||||
|
if (lastArg) usage();
|
||||||
|
qApp->setStartDragDistance(arguments.at(++i).toInt());
|
||||||
|
} else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) {
|
||||||
|
qWarning("Qt QML Viewer version %s", QT_VERSION_STR);
|
||||||
|
exitApp(0);
|
||||||
|
} else if (arg == "-translation") {
|
||||||
|
if (lastArg) usage();
|
||||||
|
opts.translationFile = arguments.at(++i);
|
||||||
|
#if defined(Q_WS_MAC)
|
||||||
|
} else if (arg == "-no-opengl") {
|
||||||
|
opts.useGL = false;
|
||||||
|
#else
|
||||||
|
} else if (arg == "-opengl") {
|
||||||
|
opts.useGL = true;
|
||||||
|
#endif
|
||||||
|
} else if (arg == "-qmlbrowser") {
|
||||||
|
opts.useNativeFileBrowser = false;
|
||||||
|
} else if (arg == "-warnings") {
|
||||||
|
if (lastArg) usage();
|
||||||
|
QString warningsStr = arguments.at(++i);
|
||||||
|
if (warningsStr == QLatin1String("show")) {
|
||||||
|
opts.warningsConfig = ShowWarnings;
|
||||||
|
} else if (warningsStr == QLatin1String("hide")) {
|
||||||
|
opts.warningsConfig = HideWarnings;
|
||||||
|
} else {
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
} else if (arg == "-I" || arg == "-L") {
|
||||||
|
if (arg == "-L")
|
||||||
|
qWarning("-L option provided for compatibility only, use -I instead");
|
||||||
|
if (lastArg) {
|
||||||
|
QDeclarativeEngine tmpEngine;
|
||||||
|
QString paths = tmpEngine.importPathList().join(QLatin1String(":"));
|
||||||
|
qWarning("Current search path: %s", paths.toLocal8Bit().constData());
|
||||||
|
exitApp(0);
|
||||||
|
}
|
||||||
|
opts.imports << arguments.at(++i);
|
||||||
|
} else if (arg == "-P") {
|
||||||
|
if (lastArg) usage();
|
||||||
|
opts.plugins << arguments.at(++i);
|
||||||
|
} else if (arg == "-script") {
|
||||||
|
if (lastArg) usage();
|
||||||
|
opts.script = arguments.at(++i);
|
||||||
|
} else if (arg == "-scriptopts") {
|
||||||
|
if (lastArg) usage();
|
||||||
|
opts.scriptopts = arguments.at(++i);
|
||||||
|
} else if (arg == "-savescript") {
|
||||||
|
if (lastArg) usage();
|
||||||
|
opts.script = arguments.at(++i);
|
||||||
|
opts.runScript = false;
|
||||||
|
} else if (arg == "-playscript") {
|
||||||
|
if (lastArg) usage();
|
||||||
|
opts.script = arguments.at(++i);
|
||||||
|
opts.runScript = true;
|
||||||
|
} else if (arg == "-sizeviewtorootobject") {
|
||||||
|
opts.sizeToView = false;
|
||||||
|
} else if (arg == "-sizerootobjecttoview") {
|
||||||
|
opts.sizeToView = true;
|
||||||
|
} else if (arg == "-experimentalgestures") {
|
||||||
|
opts.experimentalGestures = true;
|
||||||
|
} else if (!arg.startsWith('-')) {
|
||||||
|
fileNames.append(arg);
|
||||||
|
} else if (true || arg == "-help") {
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!opts.scriptopts.isEmpty()) {
|
||||||
|
|
||||||
|
parseScriptOptions();
|
||||||
|
|
||||||
|
if (opts.script.isEmpty())
|
||||||
|
usage();
|
||||||
|
|
||||||
|
if (!(opts.scriptOptions & QDeclarativeViewer::Record) && !(opts.scriptOptions & QDeclarativeViewer::Play))
|
||||||
|
scriptOptsUsage();
|
||||||
|
} else if (!opts.script.isEmpty()) {
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static QDeclarativeViewer *createViewer()
|
||||||
|
{
|
||||||
|
Qt::WFlags wflags = (opts.frameless ? Qt::FramelessWindowHint : Qt::Widget);
|
||||||
|
if (opts.stayOnTop)
|
||||||
|
wflags |= Qt::WindowStaysOnTopHint;
|
||||||
|
|
||||||
|
QDeclarativeViewer *viewer = new QDeclarativeViewer(0, wflags);
|
||||||
|
viewer->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
viewer->setUseGL(opts.useGL);
|
||||||
|
|
||||||
|
if (!opts.scriptopts.isEmpty()) {
|
||||||
|
viewer->setScriptOptions(opts.scriptOptions);
|
||||||
|
viewer->setScript(opts.script);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(Q_OS_SYMBIAN)
|
||||||
|
logger = viewer->warningsWidget();
|
||||||
|
if (opts.warningsConfig == ShowWarnings) {
|
||||||
|
logger.data()->setDefaultVisibility(LoggerWidget::ShowWarnings);
|
||||||
|
logger.data()->show();
|
||||||
|
} else if (opts.warningsConfig == HideWarnings){
|
||||||
|
logger.data()->setDefaultVisibility(LoggerWidget::HideWarnings);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (opts.experimentalGestures)
|
||||||
|
viewer->enableExperimentalGestures();
|
||||||
|
|
||||||
|
foreach (QString lib, opts.imports)
|
||||||
|
viewer->addLibraryPath(lib);
|
||||||
|
|
||||||
|
foreach (QString plugin, opts.plugins)
|
||||||
|
viewer->addPluginPath(plugin);
|
||||||
|
|
||||||
|
viewer->setNetworkCacheSize(opts.cache);
|
||||||
|
viewer->setRecordFile(opts.recordfile);
|
||||||
|
viewer->setSizeToView(opts.sizeToView);
|
||||||
|
if (opts.fps > 0)
|
||||||
|
viewer->setRecordRate(opts.fps);
|
||||||
|
if (opts.autorecord_to)
|
||||||
|
viewer->setAutoRecord(opts.autorecord_from, opts.autorecord_to);
|
||||||
|
if (opts.devkeys)
|
||||||
|
viewer->setDeviceKeys(true);
|
||||||
|
viewer->setRecordDither(opts.dither);
|
||||||
|
if (opts.recordargs.count())
|
||||||
|
viewer->setRecordArgs(opts.recordargs);
|
||||||
|
|
||||||
|
viewer->setUseNativeFileBrowser(opts.useNativeFileBrowser);
|
||||||
|
|
||||||
|
return viewer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void showViewer(QDeclarativeViewer *viewer)
|
||||||
|
{
|
||||||
|
if (opts.fullScreen)
|
||||||
|
viewer->showFullScreen();
|
||||||
|
else if (opts.maximized)
|
||||||
|
viewer->showMaximized();
|
||||||
|
else
|
||||||
|
viewer->show();
|
||||||
|
viewer->raise();
|
||||||
|
}
|
||||||
|
|
||||||
|
QDeclarativeViewer *openFile(const QString &fileName)
|
||||||
|
{
|
||||||
|
QDeclarativeViewer *viewer = globalViewer;
|
||||||
|
|
||||||
|
viewer->open(fileName);
|
||||||
|
showViewer(viewer);
|
||||||
|
|
||||||
|
return viewer;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char ** argv)
|
int main(int argc, char ** argv)
|
||||||
{
|
{
|
||||||
#if defined (Q_OS_SYMBIAN)
|
#if defined (Q_OS_SYMBIAN)
|
||||||
@@ -182,14 +540,6 @@ int main(int argc, char ** argv)
|
|||||||
systemMsgOutput = qInstallMsgHandler(myMessageOutput);
|
systemMsgOutput = qInstallMsgHandler(myMessageOutput);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (Q_OS_WIN)
|
|
||||||
// Debugging output is not visible by default on Windows -
|
|
||||||
// therefore show modal dialog with errors instead.
|
|
||||||
|
|
||||||
// (Disabled in QmlObserver: We're usually running inside QtCreator anyway, see also QTCREATORBUG-2748)
|
|
||||||
// atexit(showWarnings);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (Q_WS_X11) || defined (Q_WS_MAC)
|
#if defined (Q_WS_X11) || defined (Q_WS_MAC)
|
||||||
//### default to using raster graphics backend for now
|
//### default to using raster graphics backend for now
|
||||||
bool gsSpecified = false;
|
bool gsSpecified = false;
|
||||||
@@ -205,7 +555,7 @@ int main(int argc, char ** argv)
|
|||||||
QApplication::setGraphicsSystem("raster");
|
QApplication::setGraphicsSystem("raster");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
Application app(argc, argv);
|
||||||
app.setApplicationName("QtQmlViewer");
|
app.setApplicationName("QtQmlViewer");
|
||||||
app.setOrganizationName("Nokia");
|
app.setOrganizationName("Nokia");
|
||||||
app.setOrganizationDomain("nokia.com");
|
app.setOrganizationDomain("nokia.com");
|
||||||
@@ -213,241 +563,18 @@ int main(int argc, char ** argv)
|
|||||||
QDeclarativeViewer::registerTypes();
|
QDeclarativeViewer::registerTypes();
|
||||||
QDeclarativeTester::registerTypes();
|
QDeclarativeTester::registerTypes();
|
||||||
|
|
||||||
bool frameless = false;
|
parseCommandLineOptions(app.arguments());
|
||||||
QString fileName;
|
|
||||||
double fps = 0;
|
|
||||||
int autorecord_from = 0;
|
|
||||||
int autorecord_to = 0;
|
|
||||||
QString dither = "none";
|
|
||||||
QString recordfile;
|
|
||||||
QStringList recordargs;
|
|
||||||
QStringList imports;
|
|
||||||
QStringList plugins;
|
|
||||||
QString script;
|
|
||||||
QString scriptopts;
|
|
||||||
bool runScript = false;
|
|
||||||
bool devkeys = false;
|
|
||||||
int cache = 0;
|
|
||||||
QString translationFile;
|
|
||||||
bool useGL = false;
|
|
||||||
bool fullScreen = false;
|
|
||||||
bool stayOnTop = false;
|
|
||||||
bool maximized = false;
|
|
||||||
bool useNativeFileBrowser = true;
|
|
||||||
bool experimentalGestures = false;
|
|
||||||
bool designModeBehavior = false;
|
|
||||||
bool debuggerModeBehavior = false;
|
|
||||||
|
|
||||||
WarningsConfig warningsConfig = DefaultWarnings;
|
|
||||||
bool sizeToView = true;
|
|
||||||
|
|
||||||
#if defined(Q_OS_SYMBIAN)
|
|
||||||
maximized = true;
|
|
||||||
useNativeFileBrowser = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(Q_WS_MAC)
|
|
||||||
useGL = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (int i = 1; i < argc; ++i) {
|
|
||||||
bool lastArg = (i == argc - 1);
|
|
||||||
QString arg = argv[i];
|
|
||||||
if (arg == "-frameless") {
|
|
||||||
frameless = true;
|
|
||||||
} else if (arg == "-maximized") {
|
|
||||||
maximized = true;
|
|
||||||
} else if (arg == "-fullscreen") {
|
|
||||||
fullScreen = true;
|
|
||||||
} else if (arg == "-stayontop") {
|
|
||||||
stayOnTop = true;
|
|
||||||
} else if (arg == "-netcache") {
|
|
||||||
if (lastArg) usage();
|
|
||||||
cache = QString(argv[++i]).toInt();
|
|
||||||
} else if (arg == "-recordrate") {
|
|
||||||
if (lastArg) usage();
|
|
||||||
fps = QString(argv[++i]).toDouble();
|
|
||||||
} else if (arg == "-recordfile") {
|
|
||||||
if (lastArg) usage();
|
|
||||||
recordfile = QString(argv[++i]);
|
|
||||||
} else if (arg == "-record") {
|
|
||||||
if (lastArg) usage();
|
|
||||||
recordargs << QString(argv[++i]);
|
|
||||||
} else if (arg == "-recorddither") {
|
|
||||||
if (lastArg) usage();
|
|
||||||
dither = QString(argv[++i]);
|
|
||||||
} else if (arg == "-autorecord") {
|
|
||||||
if (lastArg) usage();
|
|
||||||
QString range = QString(argv[++i]);
|
|
||||||
int dash = range.indexOf('-');
|
|
||||||
if (dash > 0)
|
|
||||||
autorecord_from = range.left(dash).toInt();
|
|
||||||
autorecord_to = range.mid(dash+1).toInt();
|
|
||||||
} else if (arg == "-devicekeys") {
|
|
||||||
devkeys = true;
|
|
||||||
} else if (arg == "-dragthreshold") {
|
|
||||||
if (lastArg) usage();
|
|
||||||
app.setStartDragDistance(QString(argv[++i]).toInt());
|
|
||||||
} else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) {
|
|
||||||
qWarning("Qt QML Viewer version %s", QT_VERSION_STR);
|
|
||||||
exit(0);
|
|
||||||
} else if (arg == "-translation") {
|
|
||||||
if (lastArg) usage();
|
|
||||||
translationFile = argv[++i];
|
|
||||||
} else if (arg == "-opengl") {
|
|
||||||
useGL = true;
|
|
||||||
} else if (arg == "-qmlbrowser") {
|
|
||||||
useNativeFileBrowser = false;
|
|
||||||
} else if (arg == "-warnings") {
|
|
||||||
if (lastArg) usage();
|
|
||||||
QString warningsStr = QString(argv[++i]);
|
|
||||||
if (warningsStr == QLatin1String("show")) {
|
|
||||||
warningsConfig = ShowWarnings;
|
|
||||||
} else if (warningsStr == QLatin1String("hide")) {
|
|
||||||
warningsConfig = HideWarnings;
|
|
||||||
} else {
|
|
||||||
usage();
|
|
||||||
}
|
|
||||||
} else if (arg == "-I" || arg == "-L") {
|
|
||||||
if (arg == "-L")
|
|
||||||
qWarning("-L option provided for compatibility only, use -I instead");
|
|
||||||
if (lastArg) {
|
|
||||||
QDeclarativeEngine tmpEngine;
|
|
||||||
QString paths = tmpEngine.importPathList().join(QLatin1String(":"));
|
|
||||||
qWarning("Current search path: %s", paths.toLocal8Bit().constData());
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
imports << QString(argv[++i]);
|
|
||||||
} else if (arg == "-P") {
|
|
||||||
if (lastArg) usage();
|
|
||||||
plugins << QString(argv[++i]);
|
|
||||||
} else if (arg == "-script") {
|
|
||||||
if (lastArg) usage();
|
|
||||||
script = QString(argv[++i]);
|
|
||||||
} else if (arg == "-scriptopts") {
|
|
||||||
if (lastArg) usage();
|
|
||||||
scriptopts = QString(argv[++i]);
|
|
||||||
} else if (arg == "-savescript") {
|
|
||||||
if (lastArg) usage();
|
|
||||||
script = QString(argv[++i]);
|
|
||||||
runScript = false;
|
|
||||||
} else if (arg == "-playscript") {
|
|
||||||
if (lastArg) usage();
|
|
||||||
script = QString(argv[++i]);
|
|
||||||
runScript = true;
|
|
||||||
} else if (arg == "-sizeviewtorootobject") {
|
|
||||||
sizeToView = false;
|
|
||||||
} else if (arg == "-sizerootobjecttoview") {
|
|
||||||
sizeToView = true;
|
|
||||||
} else if (arg == "-experimentalgestures") {
|
|
||||||
experimentalGestures = true;
|
|
||||||
} else if (arg == "-designmode") {
|
|
||||||
designModeBehavior = true;
|
|
||||||
} else if (arg == "-debugger") {
|
|
||||||
debuggerModeBehavior = true;
|
|
||||||
} else if (arg[0] != '-') {
|
|
||||||
fileName = arg;
|
|
||||||
} else if (1 || arg == "-help") {
|
|
||||||
usage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QTranslator qmlTranslator;
|
QTranslator qmlTranslator;
|
||||||
if (!translationFile.isEmpty()) {
|
if (!opts.translationFile.isEmpty()) {
|
||||||
qmlTranslator.load(translationFile);
|
qmlTranslator.load(opts.translationFile);
|
||||||
app.installTranslator(&qmlTranslator);
|
app.installTranslator(&qmlTranslator);
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::WFlags wflags = (frameless ? Qt::FramelessWindowHint : Qt::Widget);
|
if (opts.fullScreen && opts.maximized)
|
||||||
if (stayOnTop)
|
|
||||||
wflags |= Qt::WindowStaysOnTopHint;
|
|
||||||
|
|
||||||
// enable remote debugging
|
|
||||||
QDeclarativeDebugHelper::enableDebugging();
|
|
||||||
|
|
||||||
QDeclarativeViewer *viewer = new QDeclarativeViewer(0, wflags);
|
|
||||||
viewer->setAttribute(Qt::WA_DeleteOnClose, true);
|
|
||||||
if (!scriptopts.isEmpty()) {
|
|
||||||
QStringList options =
|
|
||||||
scriptopts.split(QLatin1Char(','), QString::SkipEmptyParts);
|
|
||||||
|
|
||||||
QDeclarativeViewer::ScriptOptions scriptOptions = 0;
|
|
||||||
for (int i = 0; i < options.count(); ++i) {
|
|
||||||
const QString &option = options.at(i);
|
|
||||||
if (option == QLatin1String("help")) {
|
|
||||||
scriptOptsUsage();
|
|
||||||
} else if (option == QLatin1String("play")) {
|
|
||||||
scriptOptions |= QDeclarativeViewer::Play;
|
|
||||||
} else if (option == QLatin1String("record")) {
|
|
||||||
scriptOptions |= QDeclarativeViewer::Record;
|
|
||||||
} else if (option == QLatin1String("testimages")) {
|
|
||||||
scriptOptions |= QDeclarativeViewer::TestImages;
|
|
||||||
} else if (option == QLatin1String("testerror")) {
|
|
||||||
scriptOptions |= QDeclarativeViewer::TestErrorProperty;
|
|
||||||
} else if (option == QLatin1String("exitoncomplete")) {
|
|
||||||
scriptOptions |= QDeclarativeViewer::ExitOnComplete;
|
|
||||||
} else if (option == QLatin1String("exitonfailure")) {
|
|
||||||
scriptOptions |= QDeclarativeViewer::ExitOnFailure;
|
|
||||||
} else if (option == QLatin1String("saveonexit")) {
|
|
||||||
scriptOptions |= QDeclarativeViewer::SaveOnExit;
|
|
||||||
} else if (option == QLatin1String("snapshot")) {
|
|
||||||
scriptOptions |= QDeclarativeViewer::Snapshot;
|
|
||||||
} else {
|
|
||||||
scriptOptsUsage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (script.isEmpty())
|
|
||||||
usage();
|
|
||||||
|
|
||||||
if (!(scriptOptions & QDeclarativeViewer::Record) && !(scriptOptions & QDeclarativeViewer::Play))
|
|
||||||
scriptOptsUsage();
|
|
||||||
viewer->setScriptOptions(scriptOptions);
|
|
||||||
viewer->setScript(script);
|
|
||||||
} else if (!script.isEmpty()) {
|
|
||||||
usage();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !defined(Q_OS_SYMBIAN)
|
|
||||||
logger = viewer->warningsWidget();
|
|
||||||
if (warningsConfig == ShowWarnings) {
|
|
||||||
logger.data()->setDefaultVisibility(LoggerWidget::ShowWarnings);
|
|
||||||
logger.data()->show();
|
|
||||||
} else if (warningsConfig == HideWarnings){
|
|
||||||
logger.data()->setDefaultVisibility(LoggerWidget::HideWarnings);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (experimentalGestures)
|
|
||||||
viewer->enableExperimentalGestures();
|
|
||||||
|
|
||||||
viewer->setDesignModeBehavior(designModeBehavior);
|
|
||||||
viewer->setStayOnTop(stayOnTop);
|
|
||||||
|
|
||||||
foreach (QString lib, imports)
|
|
||||||
viewer->addLibraryPath(lib);
|
|
||||||
|
|
||||||
foreach (QString plugin, plugins)
|
|
||||||
viewer->addPluginPath(plugin);
|
|
||||||
|
|
||||||
viewer->setNetworkCacheSize(cache);
|
|
||||||
viewer->setRecordFile(recordfile);
|
|
||||||
viewer->setSizeToView(sizeToView);
|
|
||||||
if (fps>0)
|
|
||||||
viewer->setRecordRate(fps);
|
|
||||||
if (autorecord_to)
|
|
||||||
viewer->setAutoRecord(autorecord_from,autorecord_to);
|
|
||||||
if (devkeys)
|
|
||||||
viewer->setDeviceKeys(true);
|
|
||||||
viewer->setRecordDither(dither);
|
|
||||||
if (recordargs.count())
|
|
||||||
viewer->setRecordArgs(recordargs);
|
|
||||||
|
|
||||||
viewer->setUseNativeFileBrowser(useNativeFileBrowser);
|
|
||||||
if (fullScreen && maximized)
|
|
||||||
qWarning() << "Both -fullscreen and -maximized specified. Using -fullscreen.";
|
qWarning() << "Both -fullscreen and -maximized specified. Using -fullscreen.";
|
||||||
|
|
||||||
if (fileName.isEmpty()) {
|
if (fileNames.isEmpty()) {
|
||||||
QFile qmlapp(QLatin1String("qmlapp"));
|
QFile qmlapp(QLatin1String("qmlapp"));
|
||||||
if (qmlapp.exists() && qmlapp.open(QFile::ReadOnly)) {
|
if (qmlapp.exists() && qmlapp.open(QFile::ReadOnly)) {
|
||||||
QString content = QString::fromUtf8(qmlapp.readAll());
|
QString content = QString::fromUtf8(qmlapp.readAll());
|
||||||
@@ -455,24 +582,30 @@ int main(int argc, char ** argv)
|
|||||||
|
|
||||||
int newline = content.indexOf(QLatin1Char('\n'));
|
int newline = content.indexOf(QLatin1Char('\n'));
|
||||||
if (newline >= 0)
|
if (newline >= 0)
|
||||||
fileName = content.left(newline);
|
fileNames += content.left(newline);
|
||||||
else
|
else
|
||||||
fileName = content;
|
fileNames += content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fileName.isEmpty()) {
|
//enable remote debugging
|
||||||
viewer->open(fileName);
|
QDeclarativeDebugHelper::enableDebugging();
|
||||||
fullScreen ? viewer->showFullScreen() : maximized ? viewer->showMaximized() : viewer->show();
|
|
||||||
|
globalViewer = createViewer();
|
||||||
|
|
||||||
|
if (fileNames.isEmpty()) {
|
||||||
|
// show the initial viewer delayed.
|
||||||
|
// This prevents an initial viewer popping up while there
|
||||||
|
// are FileOpen events coming through the event queue
|
||||||
|
QTimer::singleShot(1, &app, SLOT(showInitialViewer()));
|
||||||
} else {
|
} else {
|
||||||
if (!useNativeFileBrowser)
|
foreach (const QString &fileName, fileNames)
|
||||||
viewer->openFile();
|
openFile(fileName);
|
||||||
fullScreen ? viewer->showFullScreen() : maximized ? viewer->showMaximized() : viewer->show();
|
|
||||||
if (useNativeFileBrowser)
|
|
||||||
viewer->openFile();
|
|
||||||
}
|
}
|
||||||
viewer->setUseGL(useGL);
|
|
||||||
viewer->raise();
|
QObject::connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "main.moc"
|
||||||
|
|||||||
@@ -48,7 +48,6 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <QGraphicsObject>
|
#include <QGraphicsObject>
|
||||||
|
|
||||||
#ifndef NO_PRIVATE_HEADERS
|
#ifndef NO_PRIVATE_HEADERS
|
||||||
#include <private/qabstractanimation_p.h>
|
#include <private/qabstractanimation_p.h>
|
||||||
#include <private/qdeclarativeitem_p.h>
|
#include <private/qdeclarativeitem_p.h>
|
||||||
@@ -56,6 +55,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
extern Q_GUI_EXPORT bool qt_applefontsmoothing_enabled;
|
||||||
|
|
||||||
QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts,
|
QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts,
|
||||||
QDeclarativeView *parent)
|
QDeclarativeView *parent)
|
||||||
@@ -67,6 +67,12 @@ QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer
|
|||||||
#ifndef NO_PRIVATE_HEADERS
|
#ifndef NO_PRIVATE_HEADERS
|
||||||
QUnifiedTimer::instance()->setConsistentTiming(true);
|
QUnifiedTimer::instance()->setConsistentTiming(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//Font antialiasing makes tests system-specific, so disable it
|
||||||
|
QFont noAA = QApplication::font();
|
||||||
|
noAA.setStyleStrategy(QFont::NoAntialias);
|
||||||
|
QApplication::setFont(noAA);
|
||||||
|
|
||||||
if (options & QDeclarativeViewer::Play)
|
if (options & QDeclarativeViewer::Play)
|
||||||
this->run();
|
this->run();
|
||||||
start();
|
start();
|
||||||
@@ -142,8 +148,25 @@ void QDeclarativeTester::imagefailure()
|
|||||||
{
|
{
|
||||||
hasFailed = true;
|
hasFailed = true;
|
||||||
|
|
||||||
if (options & QDeclarativeViewer::ExitOnFailure)
|
if (options & QDeclarativeViewer::ExitOnFailure){
|
||||||
exit(-1);
|
testSkip();
|
||||||
|
exit(hasFailed?-1:0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QDeclarativeTester::testSkip()
|
||||||
|
{
|
||||||
|
if (options & QDeclarativeViewer::TestSkipProperty){
|
||||||
|
QString e = m_view->rootObject()->property("skip").toString();
|
||||||
|
if (!e.isEmpty()) {
|
||||||
|
if(hasFailed){
|
||||||
|
qWarning() << "Test failed, but skipping it: " << e;
|
||||||
|
}else{
|
||||||
|
qWarning() << "Test skipped: " << e;
|
||||||
|
}
|
||||||
|
hasFailed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeTester::complete()
|
void QDeclarativeTester::complete()
|
||||||
@@ -155,6 +178,9 @@ void QDeclarativeTester::complete()
|
|||||||
hasFailed = true;
|
hasFailed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
testSkip();
|
||||||
if (options & QDeclarativeViewer::ExitOnComplete)
|
if (options & QDeclarativeViewer::ExitOnComplete)
|
||||||
QApplication::exit(hasFailed?-1:0);
|
QApplication::exit(hasFailed?-1:0);
|
||||||
|
|
||||||
@@ -255,7 +281,16 @@ void QDeclarativeTester::updateCurrentTime(int msec)
|
|||||||
|
|
||||||
if (options & QDeclarativeViewer::TestImages) {
|
if (options & QDeclarativeViewer::TestImages) {
|
||||||
img.fill(qRgb(255,255,255));
|
img.fill(qRgb(255,255,255));
|
||||||
|
|
||||||
|
#ifdef Q_WS_MAC
|
||||||
|
bool oldSmooth = qt_applefontsmoothing_enabled;
|
||||||
|
qt_applefontsmoothing_enabled = false;
|
||||||
|
#endif
|
||||||
QPainter p(&img);
|
QPainter p(&img);
|
||||||
|
#ifdef Q_WS_MAC
|
||||||
|
qt_applefontsmoothing_enabled = oldSmooth;
|
||||||
|
#endif
|
||||||
|
|
||||||
m_view->render(&p);
|
m_view->render(&p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,7 +301,7 @@ void QDeclarativeTester::updateCurrentTime(int msec)
|
|||||||
fe.msec = msec;
|
fe.msec = msec;
|
||||||
if (msec == 0 || !(options & QDeclarativeViewer::TestImages)) {
|
if (msec == 0 || !(options & QDeclarativeViewer::TestImages)) {
|
||||||
// Skip first frame, skip if not doing images
|
// Skip first frame, skip if not doing images
|
||||||
} else if (0 == (m_savedFrameEvents.count() % 60) || snapshot) {
|
} else if (0 == ((m_savedFrameEvents.count()-1) % 60) || snapshot) {
|
||||||
fe.image = img;
|
fe.image = img;
|
||||||
} else {
|
} else {
|
||||||
QCryptographicHash hash(QCryptographicHash::Md5);
|
QCryptographicHash hash(QCryptographicHash::Md5);
|
||||||
@@ -317,14 +352,14 @@ void QDeclarativeTester::updateCurrentTime(int msec)
|
|||||||
if (QDeclarativeVisualTestFrame *frame = qobject_cast<QDeclarativeVisualTestFrame *>(event)) {
|
if (QDeclarativeVisualTestFrame *frame = qobject_cast<QDeclarativeVisualTestFrame *>(event)) {
|
||||||
if (frame->msec() < msec) {
|
if (frame->msec() < msec) {
|
||||||
if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) {
|
if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) {
|
||||||
qWarning() << "QDeclarativeTester: Extra frame. Seen:"
|
qWarning() << "QDeclarativeTester(" << m_script << "): Extra frame. Seen:"
|
||||||
<< msec << "Expected:" << frame->msec();
|
<< msec << "Expected:" << frame->msec();
|
||||||
imagefailure();
|
imagefailure();
|
||||||
}
|
}
|
||||||
} else if (frame->msec() == msec) {
|
} else if (frame->msec() == msec) {
|
||||||
if (!frame->hash().isEmpty() && frame->hash().toUtf8() != fe.hash.toHex()) {
|
if (!frame->hash().isEmpty() && frame->hash().toUtf8() != fe.hash.toHex()) {
|
||||||
if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) {
|
if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) {
|
||||||
qWarning() << "QDeclarativeTester: Mismatched frame hash at" << msec
|
qWarning() << "QDeclarativeTester(" << m_script << "): Mismatched frame hash at" << msec
|
||||||
<< ". Seen:" << fe.hash.toHex()
|
<< ". Seen:" << fe.hash.toHex()
|
||||||
<< "Expected:" << frame->hash().toUtf8();
|
<< "Expected:" << frame->hash().toUtf8();
|
||||||
imagefailure();
|
imagefailure();
|
||||||
@@ -336,9 +371,14 @@ void QDeclarativeTester::updateCurrentTime(int msec)
|
|||||||
|
|
||||||
if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record) && !frame->image().isEmpty()) {
|
if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record) && !frame->image().isEmpty()) {
|
||||||
QImage goodImage(frame->image().toLocalFile());
|
QImage goodImage(frame->image().toLocalFile());
|
||||||
|
if (frame->msec() == 16 && goodImage.size() != img.size()){
|
||||||
|
//Also an image mismatch, but this warning is more informative. Only checked at start though.
|
||||||
|
qWarning() << "QDeclarativeTester(" << m_script << "): Size mismatch. This test must be run at " << goodImage.size();
|
||||||
|
imagefailure();
|
||||||
|
}
|
||||||
if (goodImage != img) {
|
if (goodImage != img) {
|
||||||
QString reject(frame->image().toLocalFile() + ".reject.png");
|
QString reject(frame->image().toLocalFile() + ".reject.png");
|
||||||
qWarning() << "QDeclarativeTester: Image mismatch. Reject saved to:"
|
qWarning() << "QDeclarativeTester(" << m_script << "): Image mismatch. Reject saved to:"
|
||||||
<< reject;
|
<< reject;
|
||||||
img.save(reject);
|
img.save(reject);
|
||||||
bool doDiff = (goodImage.size() == img.size());
|
bool doDiff = (goodImage.size() == img.size());
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ private:
|
|||||||
|
|
||||||
void imagefailure();
|
void imagefailure();
|
||||||
void complete();
|
void complete();
|
||||||
|
void testSkip();
|
||||||
|
|
||||||
enum Destination { View, ViewPort };
|
enum Destination { View, ViewPort };
|
||||||
void addKeyEvent(Destination, QKeyEvent *);
|
void addKeyEvent(Destination, QKeyEvent *);
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
QT += declarative script network sql
|
QT += declarative script network sql
|
||||||
|
|
||||||
contains(QT_CONFIG, opengl) {
|
contains(QT_CONFIG, opengl) {
|
||||||
QT += opengl
|
QT += opengl
|
||||||
DEFINES += GL_SUPPORTED
|
DEFINES += GL_SUPPORTED
|
||||||
}
|
}
|
||||||
|
|
||||||
!exists($$[QT_INSTALL_HEADERS]/QtCore/private/qabstractanimation_p.h) {
|
|
||||||
DEFINES += NO_PRIVATE_HEADERS
|
|
||||||
}
|
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD
|
INCLUDEPATH += $$PWD
|
||||||
|
|
||||||
HEADERS += $$PWD/qmlruntime.h \
|
HEADERS += $$PWD/qmlruntime.h \
|
||||||
@@ -16,25 +11,31 @@ HEADERS += $$PWD/qmlruntime.h \
|
|||||||
$$PWD/qdeclarativetester.h \
|
$$PWD/qdeclarativetester.h \
|
||||||
$$PWD/deviceorientation.h \
|
$$PWD/deviceorientation.h \
|
||||||
$$PWD/loggerwidget.h
|
$$PWD/loggerwidget.h
|
||||||
|
|
||||||
|
|
||||||
SOURCES += $$PWD/qmlruntime.cpp \
|
SOURCES += $$PWD/qmlruntime.cpp \
|
||||||
$$PWD/proxysettings.cpp \
|
$$PWD/proxysettings.cpp \
|
||||||
$$PWD/qdeclarativetester.cpp \
|
$$PWD/qdeclarativetester.cpp \
|
||||||
$$PWD/loggerwidget.cpp
|
$$PWD/loggerwidget.cpp
|
||||||
|
|
||||||
RESOURCES += $$PWD/qmlruntime.qrc
|
RESOURCES = $$PWD/browser/browser.qrc \
|
||||||
|
$$PWD/startup/startup.qrc
|
||||||
|
|
||||||
OTHER_FILES += toolbarstyle.css
|
symbian:!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
|
||||||
|
SOURCES += $$PWD/deviceorientation_symbian.cpp
|
||||||
maemo5 {
|
FORMS = $$PWD/recopts.ui \
|
||||||
|
$$PWD/proxysettings.ui
|
||||||
|
} else:maemo5 {
|
||||||
QT += dbus
|
QT += dbus
|
||||||
HEADERS += $$PWD/texteditautoresizer_maemo5.h
|
HEADERS += $$PWD/texteditautoresizer_maemo5.h
|
||||||
SOURCES += $$PWD/deviceorientation_maemo5.cpp
|
SOURCES += $$PWD/deviceorientation_maemo5.cpp
|
||||||
FORMS += $$PWD/recopts_maemo5.ui \
|
FORMS = $$PWD/recopts_maemo5.ui \
|
||||||
$$PWD/proxysettings_maemo5.ui
|
$$PWD/proxysettings_maemo5.ui
|
||||||
|
} else:linux-g++-maemo {
|
||||||
|
QT += dbus
|
||||||
|
SOURCES += $$PWD/deviceorientation_harmattan.cpp
|
||||||
|
FORMS = $$PWD/recopts.ui \
|
||||||
|
$$PWD/proxysettings.ui
|
||||||
} else {
|
} else {
|
||||||
SOURCES += $$PWD/deviceorientation.cpp
|
SOURCES += $$PWD/deviceorientation.cpp
|
||||||
FORMS += $$PWD/recopts.ui \
|
FORMS = $$PWD/recopts.ui \
|
||||||
$$PWD/proxysettings.ui
|
$$PWD/proxysettings.ui
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
|
CONFIG += qt uic
|
||||||
|
|
||||||
### FIXME: only debug plugins are now supported.
|
### FIXME: only debug plugins are now supported.
|
||||||
CONFIG -= release
|
CONFIG -= release
|
||||||
CONFIG += debug
|
CONFIG += debug
|
||||||
@@ -15,6 +17,44 @@ exists($$PWD/qmljsdebugger/qmljsdebugger-lib.pri) {
|
|||||||
include($$PWD/../qmljsdebugger/qmljsdebugger-lib.pri)
|
include($$PWD/../qmljsdebugger/qmljsdebugger-lib.pri)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#INCLUDEPATH += ../../include/QtDeclarative
|
||||||
|
#INCLUDEPATH += ../../src/declarative/util
|
||||||
|
#INCLUDEPATH += ../../src/declarative/graphicsitems
|
||||||
|
|
||||||
|
target.path = $$[QT_INSTALL_BINS]
|
||||||
|
INSTALLS += target
|
||||||
|
|
||||||
|
wince* {
|
||||||
|
QT += xml
|
||||||
|
|
||||||
|
contains(QT_CONFIG, scripttools) {
|
||||||
|
QT += scripttools
|
||||||
|
}
|
||||||
|
contains(QT_CONFIG, phonon) {
|
||||||
|
QT += phonon
|
||||||
|
}
|
||||||
|
contains(QT_CONFIG, xmlpatterns) {
|
||||||
|
QT += xmlpatterns
|
||||||
|
}
|
||||||
|
contains(QT_CONFIG, webkit) {
|
||||||
|
QT += webkit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maemo5 {
|
||||||
|
QT += maemo5
|
||||||
|
}
|
||||||
|
symbian {
|
||||||
|
TARGET.UID3 = 0x20021317
|
||||||
|
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
|
||||||
|
TARGET.EPOCHEAPSIZE = 0x20000 0x4000000
|
||||||
|
TARGET.CAPABILITY = NetworkServices ReadUserData
|
||||||
|
!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
|
||||||
|
LIBS += -lsensrvclient -lsensrvutil
|
||||||
|
}
|
||||||
|
contains(QT_CONFIG, s60): {
|
||||||
|
LIBS += -lavkon -lcone
|
||||||
|
}
|
||||||
|
}
|
||||||
mac {
|
mac {
|
||||||
QMAKE_INFO_PLIST=Info_mac.plist
|
QMAKE_INFO_PLIST=Info_mac.plist
|
||||||
TARGET=QMLObserver
|
TARGET=QMLObserver
|
||||||
@@ -22,4 +62,3 @@ mac {
|
|||||||
} else {
|
} else {
|
||||||
TARGET=qmlobserver
|
TARGET=qmlobserver
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,9 +54,6 @@
|
|||||||
# include "ui_recopts.h"
|
# include "ui_recopts.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <qdeclarativeviewobserver.h>
|
|
||||||
#include <qdeclarativeobserverservice.h>
|
|
||||||
|
|
||||||
#include "qmlruntime.h"
|
#include "qmlruntime.h"
|
||||||
#include <qdeclarativecontext.h>
|
#include <qdeclarativecontext.h>
|
||||||
#include <qdeclarativeengine.h>
|
#include <qdeclarativeengine.h>
|
||||||
@@ -67,6 +64,9 @@
|
|||||||
#include <private/qabstractanimation_p.h>
|
#include <private/qabstractanimation_p.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <qdeclarativeviewobserver.h>
|
||||||
|
#include <qdeclarativeobserverservice.h>
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
@@ -90,28 +90,74 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QInputDialog>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QGraphicsObject>
|
#include <QGraphicsObject>
|
||||||
#include <QNetworkProxyFactory>
|
#include <QNetworkProxyFactory>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QToolBar>
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QMutexLocker>
|
#include <QMutexLocker>
|
||||||
#include "proxysettings.h"
|
#include "proxysettings.h"
|
||||||
#include "deviceorientation.h"
|
#include "deviceorientation.h"
|
||||||
#include <QInputDialog>
|
|
||||||
|
|
||||||
#ifdef GL_SUPPORTED
|
#ifdef GL_SUPPORTED
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <qt_private/qdeclarativedebughelper_p.h>
|
#if defined(Q_WS_S60)
|
||||||
|
#include <aknappui.h> // For locking app orientation
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <qdeclarativetester.h>
|
#include <qdeclarativetester.h>
|
||||||
|
|
||||||
|
#include <qt_private/qdeclarativedebughelper_p.h>
|
||||||
#include "jsdebuggeragent.h"
|
#include "jsdebuggeragent.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class DragAndDropView : public QDeclarativeView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
DragAndDropView(QDeclarativeViewer *parent = 0)
|
||||||
|
: QDeclarativeView(parent)
|
||||||
|
{
|
||||||
|
setAcceptDrops(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dragEnterEvent(QDragEnterEvent *event)
|
||||||
|
{
|
||||||
|
const QMimeData *mimeData = event->mimeData();
|
||||||
|
if (mimeData->hasUrls())
|
||||||
|
event->acceptProposedAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dragMoveEvent(QDragMoveEvent *event)
|
||||||
|
{
|
||||||
|
event->acceptProposedAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dragLeaveEvent(QDragLeaveEvent *event)
|
||||||
|
{
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dropEvent(QDropEvent *event)
|
||||||
|
{
|
||||||
|
const QMimeData *mimeData = event->mimeData();
|
||||||
|
if (!mimeData->hasUrls())
|
||||||
|
return;
|
||||||
|
const QList<QUrl> urlList = mimeData->urls();
|
||||||
|
foreach (const QUrl &url, urlList) {
|
||||||
|
if (url.scheme() == QLatin1String("file")) {
|
||||||
|
static_cast<QDeclarativeViewer *>(parent())->open(url.toLocalFile());
|
||||||
|
event->accept();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class Runtime : public QObject
|
class Runtime : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -441,21 +487,16 @@ private:
|
|||||||
mutable QMutex mutex;
|
mutable QMutex mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NetworkAccessManagerFactory() : cacheSize(0) {}
|
|
||||||
~NetworkAccessManagerFactory() {}
|
|
||||||
|
|
||||||
QNetworkAccessManager *create(QObject *parent);
|
|
||||||
|
|
||||||
void setupProxy(QNetworkAccessManager *nam)
|
|
||||||
{
|
|
||||||
class SystemProxyFactory : public QNetworkProxyFactory
|
class SystemProxyFactory : public QNetworkProxyFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
SystemProxyFactory() : proxyDirty(true), httpProxyInUse(false) {
|
||||||
|
}
|
||||||
|
|
||||||
virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query)
|
virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query)
|
||||||
{
|
{
|
||||||
|
if (proxyDirty)
|
||||||
|
setupProxy();
|
||||||
QString protocolTag = query.protocolTag();
|
QString protocolTag = query.protocolTag();
|
||||||
if (httpProxyInUse && (protocolTag == "http" || protocolTag == "https")) {
|
if (httpProxyInUse && (protocolTag == "http" || protocolTag == "https")) {
|
||||||
QList<QNetworkProxy> ret;
|
QList<QNetworkProxy> ret;
|
||||||
@@ -469,27 +510,35 @@ public:
|
|||||||
return QNetworkProxyFactory::systemProxyForQuery(query);
|
return QNetworkProxyFactory::systemProxyForQuery(query);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void setHttpProxy (QNetworkProxy proxy)
|
|
||||||
{
|
void setupProxy() {
|
||||||
httpProxy = proxy;
|
// Don't bother locking because we know that the proxy only
|
||||||
httpProxyInUse = true;
|
// 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 unsetHttpProxy ()
|
|
||||||
{
|
void proxyChanged() {
|
||||||
httpProxyInUse = false;
|
proxyDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
volatile bool proxyDirty;
|
||||||
bool httpProxyInUse;
|
bool httpProxyInUse;
|
||||||
QNetworkProxy httpProxy;
|
QNetworkProxy httpProxy;
|
||||||
};
|
};
|
||||||
|
|
||||||
SystemProxyFactory *proxyFactory = new SystemProxyFactory;
|
class NetworkAccessManagerFactory : public QObject, public QDeclarativeNetworkAccessManagerFactory
|
||||||
if (ProxySettings::httpProxyInUse())
|
{
|
||||||
proxyFactory->setHttpProxy(ProxySettings::httpProxy());
|
Q_OBJECT
|
||||||
else
|
public:
|
||||||
proxyFactory->unsetHttpProxy();
|
NetworkAccessManagerFactory() : cacheSize(0) {}
|
||||||
nam->setProxyFactory(proxyFactory);
|
~NetworkAccessManagerFactory() {}
|
||||||
}
|
|
||||||
|
QNetworkAccessManager *create(QObject *parent);
|
||||||
|
|
||||||
void setCacheSize(int size) {
|
void setCacheSize(int size) {
|
||||||
if (size != cacheSize) {
|
if (size != cacheSize) {
|
||||||
@@ -497,9 +546,23 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void proxyChanged() {
|
||||||
|
foreach (QNetworkAccessManager *nam, namList) {
|
||||||
|
static_cast<SystemProxyFactory*>(nam->proxyFactory())->proxyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static PersistentCookieJar *cookieJar;
|
static PersistentCookieJar *cookieJar;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void managerDestroyed(QObject *obj) {
|
||||||
|
namList.removeOne(static_cast<QNetworkAccessManager*>(obj));
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
QMutex mutex;
|
QMutex mutex;
|
||||||
int cacheSize;
|
int cacheSize;
|
||||||
|
QList<QNetworkAccessManager*> namList;
|
||||||
};
|
};
|
||||||
|
|
||||||
PersistentCookieJar *NetworkAccessManagerFactory::cookieJar = 0;
|
PersistentCookieJar *NetworkAccessManagerFactory::cookieJar = 0;
|
||||||
@@ -520,7 +583,7 @@ QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent)
|
|||||||
}
|
}
|
||||||
manager->setCookieJar(cookieJar);
|
manager->setCookieJar(cookieJar);
|
||||||
cookieJar->setParent(0);
|
cookieJar->setParent(0);
|
||||||
setupProxy(manager);
|
manager->setProxyFactory(new SystemProxyFactory);
|
||||||
if (cacheSize > 0) {
|
if (cacheSize > 0) {
|
||||||
QNetworkDiskCache *cache = new QNetworkDiskCache;
|
QNetworkDiskCache *cache = new QNetworkDiskCache;
|
||||||
cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-viewer-network-cache"));
|
cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-viewer-network-cache"));
|
||||||
@@ -529,6 +592,8 @@ QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent)
|
|||||||
} else {
|
} else {
|
||||||
manager->setCache(0);
|
manager->setCache(0);
|
||||||
}
|
}
|
||||||
|
connect(manager, SIGNAL(destroyed(QObject*)), this, SLOT(managerDestroyed(QObject*)));
|
||||||
|
namList.append(manager);
|
||||||
qDebug() << "created new network access manager for" << parent;
|
qDebug() << "created new network access manager for" << parent;
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
@@ -548,13 +613,13 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
|
|||||||
: QMainWindow(parent, flags)
|
: QMainWindow(parent, flags)
|
||||||
, loggerWindow(new LoggerWidget(this))
|
, loggerWindow(new LoggerWidget(this))
|
||||||
, frame_stream(0)
|
, frame_stream(0)
|
||||||
|
, rotateAction(0)
|
||||||
, orientation(0)
|
, orientation(0)
|
||||||
, showWarningsWindow(0)
|
, showWarningsWindow(0)
|
||||||
, designModeBehaviorAction(0)
|
, designModeBehaviorAction(0)
|
||||||
, m_scriptOptions(0)
|
, m_scriptOptions(0)
|
||||||
, tester(0)
|
, tester(0)
|
||||||
, useQmlFileBrowser(true)
|
, useQmlFileBrowser(true)
|
||||||
, m_centralWidget(0)
|
|
||||||
, translator(0)
|
, translator(0)
|
||||||
{
|
{
|
||||||
QDeclarativeViewer::registerTypes();
|
QDeclarativeViewer::registerTypes();
|
||||||
@@ -589,28 +654,18 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
|
|||||||
recdlg->warning->hide();
|
recdlg->warning->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas = new QDeclarativeView(this);
|
canvas = new DragAndDropView(this);
|
||||||
observer = new QmlJSDebugger::QDeclarativeViewObserver(canvas, this);
|
observer = new QmlJSDebugger::QDeclarativeViewObserver(canvas, this);
|
||||||
new QmlJSDebugger::JSDebuggerAgent(canvas->engine());
|
new QmlJSDebugger::JSDebuggerAgent(canvas->engine());
|
||||||
|
|
||||||
m_centralWidget = new QWidget(this);
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(m_centralWidget);
|
|
||||||
layout->setMargin(0);
|
|
||||||
layout->setSpacing(0);
|
|
||||||
|
|
||||||
|
|
||||||
layout->addWidget(canvas);
|
|
||||||
m_centralWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
||||||
|
|
||||||
canvas->setAttribute(Qt::WA_OpaquePaintEvent);
|
canvas->setAttribute(Qt::WA_OpaquePaintEvent);
|
||||||
canvas->setAttribute(Qt::WA_NoSystemBackground);
|
canvas->setAttribute(Qt::WA_NoSystemBackground);
|
||||||
|
|
||||||
canvas->setFocus();
|
canvas->setFocus();
|
||||||
|
|
||||||
QObject::connect(observer, SIGNAL(reloadRequested()), this, SLOT(reload()));
|
|
||||||
QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize)));
|
QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize)));
|
||||||
QObject::connect(canvas, SIGNAL(statusChanged(QDeclarativeView::Status)), this, SLOT(statusChanged()));
|
QObject::connect(canvas, SIGNAL(statusChanged(QDeclarativeView::Status)), this, SLOT(statusChanged()));
|
||||||
QObject::connect(canvas->engine(), SIGNAL(quit()), QCoreApplication::instance (), SLOT(quit()));
|
QObject::connect(canvas->engine(), SIGNAL(quit()), this, SLOT(close()));
|
||||||
|
|
||||||
QObject::connect(warningsWidget(), SIGNAL(opened()), this, SLOT(warningsWidgetOpened()));
|
QObject::connect(warningsWidget(), SIGNAL(opened()), this, SLOT(warningsWidgetOpened()));
|
||||||
QObject::connect(warningsWidget(), SIGNAL(closed()), this, SLOT(warningsWidgetClosed()));
|
QObject::connect(warningsWidget(), SIGNAL(closed()), this, SLOT(warningsWidgetClosed()));
|
||||||
@@ -622,7 +677,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
|
|||||||
setMenuBar(0);
|
setMenuBar(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
setCentralWidget(m_centralWidget);
|
setCentralWidget(canvas);
|
||||||
|
|
||||||
namFactory = new NetworkAccessManagerFactory;
|
namFactory = new NetworkAccessManagerFactory;
|
||||||
canvas->engine()->setNetworkAccessManagerFactory(namFactory);
|
canvas->engine()->setNetworkAccessManagerFactory(namFactory);
|
||||||
@@ -655,12 +710,14 @@ void QDeclarativeViewer::setDesignModeBehavior(bool value)
|
|||||||
|
|
||||||
void QDeclarativeViewer::enableExperimentalGestures()
|
void QDeclarativeViewer::enableExperimentalGestures()
|
||||||
{
|
{
|
||||||
|
#ifndef QT_NO_GESTURES
|
||||||
canvas->viewport()->grabGesture(Qt::TapGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
|
canvas->viewport()->grabGesture(Qt::TapGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
|
||||||
canvas->viewport()->grabGesture(Qt::TapAndHoldGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
|
canvas->viewport()->grabGesture(Qt::TapAndHoldGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
|
||||||
canvas->viewport()->grabGesture(Qt::PanGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
|
canvas->viewport()->grabGesture(Qt::PanGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
|
||||||
canvas->viewport()->grabGesture(Qt::PinchGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
|
canvas->viewport()->grabGesture(Qt::PinchGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
|
||||||
canvas->viewport()->grabGesture(Qt::SwipeGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
|
canvas->viewport()->grabGesture(Qt::SwipeGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
|
||||||
canvas->viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
|
canvas->viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QDeclarativeView *QDeclarativeViewer::view() const
|
QDeclarativeView *QDeclarativeViewer::view() const
|
||||||
@@ -676,11 +733,14 @@ LoggerWidget *QDeclarativeViewer::warningsWidget() const
|
|||||||
void QDeclarativeViewer::createMenu()
|
void QDeclarativeViewer::createMenu()
|
||||||
{
|
{
|
||||||
QAction *openAction = new QAction(tr("&Open..."), this);
|
QAction *openAction = new QAction(tr("&Open..."), this);
|
||||||
openAction->setShortcut(QKeySequence("Ctrl+O"));
|
openAction->setShortcuts(QKeySequence::Open);
|
||||||
connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
|
connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
|
||||||
|
|
||||||
|
QAction *openUrlAction = new QAction(tr("Open &URL..."), this);
|
||||||
|
connect(openUrlAction, SIGNAL(triggered()), this, SLOT(openUrl()));
|
||||||
|
|
||||||
QAction *reloadAction = new QAction(tr("&Reload"), this);
|
QAction *reloadAction = new QAction(tr("&Reload"), this);
|
||||||
reloadAction->setShortcut(QKeySequence("Ctrl+R"));
|
reloadAction->setShortcuts(QKeySequence::Refresh);
|
||||||
connect(reloadAction, SIGNAL(triggered()), this, SLOT(reload()));
|
connect(reloadAction, SIGNAL(triggered()), this, SLOT(reload()));
|
||||||
|
|
||||||
QAction *snapshotAction = new QAction(tr("&Take Snapshot"), this);
|
QAction *snapshotAction = new QAction(tr("&Take Snapshot"), this);
|
||||||
@@ -690,9 +750,6 @@ void QDeclarativeViewer::createMenu()
|
|||||||
recordAction = new QAction(tr("Start Recording &Video"), this);
|
recordAction = new QAction(tr("Start Recording &Video"), this);
|
||||||
recordAction->setShortcut(QKeySequence("F9"));
|
recordAction->setShortcut(QKeySequence("F9"));
|
||||||
connect(recordAction, SIGNAL(triggered()), this, SLOT(toggleRecordingWithSelection()));
|
connect(recordAction, SIGNAL(triggered()), this, SLOT(toggleRecordingWithSelection()));
|
||||||
#ifdef NO_PRIVATE_HEADERS
|
|
||||||
recordAction->setEnabled(false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QAction *recordOptions = new QAction(tr("Video &Options..."), this);
|
QAction *recordOptions = new QAction(tr("Video &Options..."), this);
|
||||||
connect(recordOptions, SIGNAL(triggered()), this, SLOT(chooseRecordingOptions()));
|
connect(recordOptions, SIGNAL(triggered()), this, SLOT(chooseRecordingOptions()));
|
||||||
@@ -715,6 +772,7 @@ void QDeclarativeViewer::createMenu()
|
|||||||
|
|
||||||
speedAction = playSpeedMenu->addAction(tr("0.25x"), this, SLOT(changeAnimationSpeed()));
|
speedAction = playSpeedMenu->addAction(tr("0.25x"), this, SLOT(changeAnimationSpeed()));
|
||||||
speedAction->setCheckable(true);
|
speedAction->setCheckable(true);
|
||||||
|
speedAction->setCheckable(true);
|
||||||
speedAction->setData(4.0f);
|
speedAction->setData(4.0f);
|
||||||
playSpeedMenuActions->addAction(speedAction);
|
playSpeedMenuActions->addAction(speedAction);
|
||||||
|
|
||||||
@@ -753,7 +811,8 @@ void QDeclarativeViewer::createMenu()
|
|||||||
designModeBehaviorAction->setEnabled(QmlJSDebugger::QDeclarativeObserverService::hasDebuggingClient());
|
designModeBehaviorAction->setEnabled(QmlJSDebugger::QDeclarativeObserverService::hasDebuggingClient());
|
||||||
connect(designModeBehaviorAction, SIGNAL(triggered(bool)), this, SLOT(setDesignModeBehavior(bool)));
|
connect(designModeBehaviorAction, SIGNAL(triggered(bool)), this, SLOT(setDesignModeBehavior(bool)));
|
||||||
connect(observer, SIGNAL(designModeBehaviorChanged(bool)), designModeBehaviorAction, SLOT(setChecked(bool)));
|
connect(observer, SIGNAL(designModeBehaviorChanged(bool)), designModeBehaviorAction, SLOT(setChecked(bool)));
|
||||||
connect(QmlJSDebugger::QDeclarativeObserverService::instance(), SIGNAL(debuggingClientChanged(bool)), designModeBehaviorAction, SLOT(setEnabled(bool)));
|
connect(QmlJSDebugger::QDeclarativeObserverService::instance(), SIGNAL(debuggingClientChanged(bool)),
|
||||||
|
designModeBehaviorAction, SLOT(setEnabled(bool)));
|
||||||
|
|
||||||
appOnTopAction = new QAction(tr("Keep Window on Top"), this);
|
appOnTopAction = new QAction(tr("Keep Window on Top"), this);
|
||||||
appOnTopAction->setCheckable(true);
|
appOnTopAction->setCheckable(true);
|
||||||
@@ -769,28 +828,40 @@ void QDeclarativeViewer::createMenu()
|
|||||||
fullscreenAction->setCheckable(true);
|
fullscreenAction->setCheckable(true);
|
||||||
connect(fullscreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
|
connect(fullscreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
|
||||||
|
|
||||||
QAction *rotateOrientation = new QAction(tr("Rotate orientation"), this);
|
rotateAction = new QAction(tr("Rotate orientation"), this);
|
||||||
rotateOrientation->setShortcut(QKeySequence("Ctrl+T"));
|
rotateAction->setShortcut(QKeySequence("Ctrl+T"));
|
||||||
connect(rotateOrientation, SIGNAL(triggered()), this, SLOT(rotateOrientation()));
|
connect(rotateAction, SIGNAL(triggered()), this, SLOT(rotateOrientation()));
|
||||||
|
|
||||||
orientation = new QActionGroup(this);
|
orientation = new QActionGroup(this);
|
||||||
orientation->setExclusive(true);
|
orientation->setExclusive(true);
|
||||||
connect(orientation, SIGNAL(triggered(QAction*)), this, SLOT(changeOrientation(QAction*)));
|
connect(orientation, SIGNAL(triggered(QAction*)), this, SLOT(changeOrientation(QAction*)));
|
||||||
|
|
||||||
|
#if defined(Q_OS_SYMBIAN)
|
||||||
|
QAction *autoOrientationAction = new QAction(tr("Auto-orientation"), this);
|
||||||
|
autoOrientationAction->setCheckable(true);
|
||||||
|
#endif
|
||||||
QAction *portraitAction = new QAction(tr("Portrait"), this);
|
QAction *portraitAction = new QAction(tr("Portrait"), this);
|
||||||
portraitAction->setCheckable(true);
|
portraitAction->setCheckable(true);
|
||||||
QAction *landscapeAction = new QAction(tr("Landscape"), this);
|
QAction *landscapeAction = new QAction(tr("Landscape"), this);
|
||||||
landscapeAction->setCheckable(true);
|
landscapeAction->setCheckable(true);
|
||||||
|
#if !defined(Q_OS_SYMBIAN)
|
||||||
QAction *portraitInvAction = new QAction(tr("Portrait (inverted)"), this);
|
QAction *portraitInvAction = new QAction(tr("Portrait (inverted)"), this);
|
||||||
portraitInvAction->setCheckable(true);
|
portraitInvAction->setCheckable(true);
|
||||||
QAction *landscapeInvAction = new QAction(tr("Landscape (inverted)"), this);
|
QAction *landscapeInvAction = new QAction(tr("Landscape (inverted)"), this);
|
||||||
landscapeInvAction->setCheckable(true);
|
landscapeInvAction->setCheckable(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
QAction *aboutAction = new QAction(tr("&About Qt..."), this);
|
QAction *aboutAction = new QAction(tr("&About Qt..."), this);
|
||||||
|
aboutAction->setMenuRole(QAction::AboutQtRole);
|
||||||
connect(aboutAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
connect(aboutAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
||||||
|
|
||||||
|
QAction *closeAction = new QAction(tr("&Close"), this);
|
||||||
|
closeAction->setShortcuts(QKeySequence::Close);
|
||||||
|
connect(closeAction, SIGNAL(triggered()), this, SLOT(close()));
|
||||||
|
|
||||||
QAction *quitAction = new QAction(tr("&Quit"), this);
|
QAction *quitAction = new QAction(tr("&Quit"), this);
|
||||||
quitAction->setShortcut(QKeySequence("Ctrl+Q"));
|
quitAction->setMenuRole(QAction::QuitRole);
|
||||||
|
quitAction->setShortcuts(QKeySequence::Quit);
|
||||||
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
|
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
|
||||||
|
|
||||||
QMenuBar *menu = menuBar();
|
QMenuBar *menu = menuBar();
|
||||||
@@ -799,6 +870,7 @@ void QDeclarativeViewer::createMenu()
|
|||||||
|
|
||||||
#if defined(Q_WS_MAEMO_5)
|
#if defined(Q_WS_MAEMO_5)
|
||||||
menu->addAction(openAction);
|
menu->addAction(openAction);
|
||||||
|
menu->addAction(openUrlAction);
|
||||||
menu->addAction(reloadAction);
|
menu->addAction(reloadAction);
|
||||||
|
|
||||||
menu->addAction(snapshotAction);
|
menu->addAction(snapshotAction);
|
||||||
@@ -819,38 +891,45 @@ void QDeclarativeViewer::createMenu()
|
|||||||
|
|
||||||
QMenu *fileMenu = menu->addMenu(tr("&File"));
|
QMenu *fileMenu = menu->addMenu(tr("&File"));
|
||||||
fileMenu->addAction(openAction);
|
fileMenu->addAction(openAction);
|
||||||
|
fileMenu->addAction(openUrlAction);
|
||||||
fileMenu->addAction(reloadAction);
|
fileMenu->addAction(reloadAction);
|
||||||
fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
|
fileMenu->addAction(closeAction);
|
||||||
|
#if !defined(Q_OS_SYMBIAN)
|
||||||
fileMenu->addAction(quitAction);
|
fileMenu->addAction(quitAction);
|
||||||
|
|
||||||
#if !defined(Q_OS_SYMBIAN)
|
|
||||||
QMenu *recordMenu = menu->addMenu(tr("&Recording"));
|
QMenu *recordMenu = menu->addMenu(tr("&Recording"));
|
||||||
recordMenu->addAction(snapshotAction);
|
recordMenu->addAction(snapshotAction);
|
||||||
recordMenu->addAction(recordAction);
|
recordMenu->addAction(recordAction);
|
||||||
|
|
||||||
QMenu *debugMenu = menu->addMenu(tr("&Debugging"));
|
QMenu *debugMenu = menu->addMenu(tr("&Debugging"));
|
||||||
debugMenu->addAction(playSpeedAction);
|
debugMenu->addMenu(playSpeedMenu);
|
||||||
debugMenu->addAction(showWarningsWindow);
|
debugMenu->addAction(showWarningsWindow);
|
||||||
debugMenu->addAction(designModeBehaviorAction);
|
debugMenu->addAction(designModeBehaviorAction);
|
||||||
debugMenu->addAction(appOnTopAction);
|
debugMenu->addAction(appOnTopAction);
|
||||||
#endif // ! Q_OS_SYMBIAN
|
#endif // ! Q_OS_SYMBIAN
|
||||||
|
|
||||||
QMenu *settingsMenu = menu->addMenu(tr("S&ettings"));
|
QMenu *settingsMenu = menu->addMenu(tr("&Settings"));
|
||||||
settingsMenu->addAction(proxyAction);
|
settingsMenu->addAction(proxyAction);
|
||||||
#if !defined(Q_OS_SYMBIAN)
|
#if defined(Q_OS_SYMBIAN)
|
||||||
|
settingsMenu->addAction(fullscreenAction);
|
||||||
|
#else
|
||||||
settingsMenu->addAction(recordOptions);
|
settingsMenu->addAction(recordOptions);
|
||||||
settingsMenu->addMenu(loggerWindow->preferencesMenu());
|
settingsMenu->addMenu(loggerWindow->preferencesMenu());
|
||||||
#else // ! Q_OS_SYMBIAN
|
#endif // !Q_OS_SYMBIAN
|
||||||
settingsMenu->addAction(fullscreenAction);
|
settingsMenu->addAction(rotateAction);
|
||||||
#endif // Q_OS_SYMBIAN
|
|
||||||
settingsMenu->addAction(rotateOrientation);
|
|
||||||
|
|
||||||
QMenu *propertiesMenu = settingsMenu->addMenu(tr("Properties"));
|
QMenu *propertiesMenu = settingsMenu->addMenu(tr("Properties"));
|
||||||
|
|
||||||
|
#if defined(Q_OS_SYMBIAN)
|
||||||
|
orientation->addAction(autoOrientationAction);
|
||||||
|
#endif
|
||||||
orientation->addAction(portraitAction);
|
orientation->addAction(portraitAction);
|
||||||
orientation->addAction(landscapeAction);
|
orientation->addAction(landscapeAction);
|
||||||
|
#if !defined(Q_OS_SYMBIAN)
|
||||||
orientation->addAction(portraitInvAction);
|
orientation->addAction(portraitInvAction);
|
||||||
orientation->addAction(landscapeInvAction);
|
orientation->addAction(landscapeInvAction);
|
||||||
|
#endif
|
||||||
propertiesMenu->addActions(orientation->actions());
|
propertiesMenu->addActions(orientation->actions());
|
||||||
|
|
||||||
QMenu *helpMenu = menu->addMenu(tr("&Help"));
|
QMenu *helpMenu = menu->addMenu(tr("&Help"));
|
||||||
@@ -868,11 +947,29 @@ void QDeclarativeViewer::showProxySettings()
|
|||||||
|
|
||||||
void QDeclarativeViewer::proxySettingsChanged()
|
void QDeclarativeViewer::proxySettingsChanged()
|
||||||
{
|
{
|
||||||
|
namFactory->proxyChanged();
|
||||||
reload ();
|
reload ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewer::rotateOrientation()
|
void QDeclarativeViewer::rotateOrientation()
|
||||||
{
|
{
|
||||||
|
#if defined(Q_WS_S60)
|
||||||
|
CAknAppUi *appUi = static_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
|
||||||
|
if (appUi) {
|
||||||
|
CAknAppUi::TAppUiOrientation oldOrientation = appUi->Orientation();
|
||||||
|
QString newOrientation;
|
||||||
|
if (oldOrientation == CAknAppUi::EAppUiOrientationPortrait) {
|
||||||
|
newOrientation = QLatin1String("Landscape");
|
||||||
|
} else {
|
||||||
|
newOrientation = QLatin1String("Portrait");
|
||||||
|
}
|
||||||
|
foreach (QAction *action, orientation->actions()) {
|
||||||
|
if (action->text() == newOrientation) {
|
||||||
|
changeOrientation(action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
QAction *current = orientation->checkedAction();
|
QAction *current = orientation->checkedAction();
|
||||||
QList<QAction *> actions = orientation->actions();
|
QList<QAction *> actions = orientation->actions();
|
||||||
int index = actions.indexOf(current);
|
int index = actions.indexOf(current);
|
||||||
@@ -881,6 +978,7 @@ void QDeclarativeViewer::rotateOrientation()
|
|||||||
|
|
||||||
QAction *newOrientation = actions[(index + 1) % actions.count()];
|
QAction *newOrientation = actions[(index + 1) % actions.count()];
|
||||||
changeOrientation(newOrientation);
|
changeOrientation(newOrientation);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewer::toggleFullScreen()
|
void QDeclarativeViewer::toggleFullScreen()
|
||||||
@@ -1027,15 +1125,14 @@ void QDeclarativeViewer::addPluginPath(const QString& plugin)
|
|||||||
|
|
||||||
void QDeclarativeViewer::reload()
|
void QDeclarativeViewer::reload()
|
||||||
{
|
{
|
||||||
observer->setDesignModeBehavior(false);
|
launch(currentFileOrUrl);
|
||||||
open(currentFileOrUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewer::openFile()
|
void QDeclarativeViewer::openFile()
|
||||||
{
|
{
|
||||||
QString cur = canvas->source().toLocalFile();
|
QString cur = canvas->source().toLocalFile();
|
||||||
if (useQmlFileBrowser) {
|
if (useQmlFileBrowser) {
|
||||||
open("qrc:/content/Browser.qml");
|
open("qrc:/browser/Browser.qml");
|
||||||
} else {
|
} else {
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open QML file"), cur, tr("QML Files (*.qml)"));
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Open QML file"), cur, tr("QML Files (*.qml)"));
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
@@ -1045,6 +1142,14 @@ void QDeclarativeViewer::openFile()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QDeclarativeViewer::openUrl()
|
||||||
|
{
|
||||||
|
QString cur = canvas->source().toLocalFile();
|
||||||
|
QString url= QInputDialog::getText(this, tr("Open QML file"), tr("URL of main QML file:"), QLineEdit::Normal, cur);
|
||||||
|
if (!url.isEmpty())
|
||||||
|
open(url);
|
||||||
|
}
|
||||||
|
|
||||||
void QDeclarativeViewer::statusChanged()
|
void QDeclarativeViewer::statusChanged()
|
||||||
{
|
{
|
||||||
if (canvas->status() == QDeclarativeView::Error && tester)
|
if (canvas->status() == QDeclarativeView::Error && tester)
|
||||||
@@ -1077,11 +1182,7 @@ void QDeclarativeViewer::loadDummyDataFiles(const QString& directory)
|
|||||||
QStringList list = dir.entryList();
|
QStringList list = dir.entryList();
|
||||||
for (int i = 0; i < list.size(); ++i) {
|
for (int i = 0; i < list.size(); ++i) {
|
||||||
QString qml = list.at(i);
|
QString qml = list.at(i);
|
||||||
QFile f(dir.filePath(qml));
|
QDeclarativeComponent comp(canvas->engine(), dir.filePath(qml));
|
||||||
f.open(QIODevice::ReadOnly);
|
|
||||||
QByteArray data = f.readAll();
|
|
||||||
QDeclarativeComponent comp(canvas->engine());
|
|
||||||
comp.setData(data, QUrl());
|
|
||||||
QObject *dummyData = comp.create();
|
QObject *dummyData = comp.create();
|
||||||
|
|
||||||
if(comp.isError()) {
|
if(comp.isError()) {
|
||||||
@@ -1220,8 +1321,10 @@ bool QDeclarativeViewer::event(QEvent *event)
|
|||||||
{
|
{
|
||||||
if (event->type() == QEvent::WindowActivate) {
|
if (event->type() == QEvent::WindowActivate) {
|
||||||
Runtime::instance()->setActiveWindow(true);
|
Runtime::instance()->setActiveWindow(true);
|
||||||
|
DeviceOrientation::instance()->resumeListening();
|
||||||
} else if (event->type() == QEvent::WindowDeactivate) {
|
} else if (event->type() == QEvent::WindowDeactivate) {
|
||||||
Runtime::instance()->setActiveWindow(false);
|
Runtime::instance()->setActiveWindow(false);
|
||||||
|
DeviceOrientation::instance()->pauseListening();
|
||||||
}
|
}
|
||||||
return QWidget::event(event);
|
return QWidget::event(event);
|
||||||
}
|
}
|
||||||
@@ -1397,6 +1500,8 @@ void QDeclarativeViewer::appAboutToQuit()
|
|||||||
// avoid crashes if messages are received after app has closed
|
// avoid crashes if messages are received after app has closed
|
||||||
delete loggerWindow;
|
delete loggerWindow;
|
||||||
loggerWindow = 0;
|
loggerWindow = 0;
|
||||||
|
delete tester;
|
||||||
|
tester = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewer::autoStartRecording()
|
void QDeclarativeViewer::autoStartRecording()
|
||||||
@@ -1431,9 +1536,24 @@ void QDeclarativeViewer::changeOrientation(QAction *action)
|
|||||||
{
|
{
|
||||||
if (!action)
|
if (!action)
|
||||||
return;
|
return;
|
||||||
action->setChecked(true);
|
|
||||||
|
|
||||||
QString o = action->text();
|
QString o = action->text();
|
||||||
|
action->setChecked(true);
|
||||||
|
#if defined(Q_WS_S60)
|
||||||
|
CAknAppUi *appUi = static_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
|
||||||
|
if (appUi) {
|
||||||
|
CAknAppUi::TAppUiOrientation orientation = appUi->Orientation();
|
||||||
|
if (o == QLatin1String("Auto-orientation")) {
|
||||||
|
appUi->SetOrientationL(CAknAppUi::EAppUiOrientationAutomatic);
|
||||||
|
rotateAction->setVisible(false);
|
||||||
|
} else if (o == QLatin1String("Portrait")) {
|
||||||
|
appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait);
|
||||||
|
rotateAction->setVisible(true);
|
||||||
|
} else if (o == QLatin1String("Landscape")) {
|
||||||
|
appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape);
|
||||||
|
rotateAction->setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (o == QLatin1String("Portrait"))
|
if (o == QLatin1String("Portrait"))
|
||||||
DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait);
|
DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait);
|
||||||
else if (o == QLatin1String("Landscape"))
|
else if (o == QLatin1String("Landscape"))
|
||||||
@@ -1442,6 +1562,7 @@ void QDeclarativeViewer::changeOrientation(QAction *action)
|
|||||||
DeviceOrientation::instance()->setOrientation(DeviceOrientation::PortraitInverted);
|
DeviceOrientation::instance()->setOrientation(DeviceOrientation::PortraitInverted);
|
||||||
else if (o == QLatin1String("Landscape (inverted)"))
|
else if (o == QLatin1String("Landscape (inverted)"))
|
||||||
DeviceOrientation::instance()->setOrientation(DeviceOrientation::LandscapeInverted);
|
DeviceOrientation::instance()->setOrientation(DeviceOrientation::LandscapeInverted);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewer::orientationChanged()
|
void QDeclarativeViewer::orientationChanged()
|
||||||
@@ -1517,7 +1638,6 @@ void QDeclarativeViewer::updateSizeHints(bool initial)
|
|||||||
QSize newWindowSize = initial ? initialSize : canvas->sizeHint();
|
QSize newWindowSize = initial ? initialSize : canvas->sizeHint();
|
||||||
//qWarning() << "USH:" << (initial ? "INIT:" : "V2R:") << "setting fixed size " << newWindowSize;
|
//qWarning() << "USH:" << (initial ? "INIT:" : "V2R:") << "setting fixed size " << newWindowSize;
|
||||||
if (!isFullScreen() && !isMaximized()) {
|
if (!isFullScreen() && !isMaximized()) {
|
||||||
m_centralWidget->setFixedSize(newWindowSize.width(), newWindowSize.height() + 32);
|
|
||||||
canvas->setFixedSize(newWindowSize);
|
canvas->setFixedSize(newWindowSize);
|
||||||
resize(1, 1);
|
resize(1, 1);
|
||||||
layout()->setSizeConstraint(QLayout::SetFixedSize);
|
layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||||
@@ -1527,18 +1647,14 @@ void QDeclarativeViewer::updateSizeHints(bool initial)
|
|||||||
//qWarning() << "USH: R2V: setting free size ";
|
//qWarning() << "USH: R2V: setting free size ";
|
||||||
layout()->setSizeConstraint(QLayout::SetNoConstraint);
|
layout()->setSizeConstraint(QLayout::SetNoConstraint);
|
||||||
layout()->activate();
|
layout()->activate();
|
||||||
|
setMinimumSize(minimumSizeHint());
|
||||||
setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
|
setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
|
||||||
canvas->setMinimumSize(QSize(0,0));
|
canvas->setMinimumSize(QSize(0,0));
|
||||||
canvas->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
|
canvas->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
|
||||||
|
|
||||||
m_centralWidget->setMinimumSize(QSize(0,0));
|
|
||||||
m_centralWidget->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
|
|
||||||
|
|
||||||
isRecursive = false;
|
isRecursive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QDeclarativeViewer::registerTypes()
|
void QDeclarativeViewer::registerTypes()
|
||||||
{
|
{
|
||||||
static bool registered = false;
|
static bool registered = false;
|
||||||
@@ -1546,6 +1662,7 @@ void QDeclarativeViewer::registerTypes()
|
|||||||
if (!registered) {
|
if (!registered) {
|
||||||
// registering only for exposing the DeviceOrientation::Orientation enum
|
// registering only for exposing the DeviceOrientation::Orientation enum
|
||||||
qmlRegisterUncreatableType<DeviceOrientation>("Qt",4,7,"Orientation","");
|
qmlRegisterUncreatableType<DeviceOrientation>("Qt",4,7,"Orientation","");
|
||||||
|
qmlRegisterUncreatableType<DeviceOrientation>("QtQuick",1,0,"Orientation","");
|
||||||
registered = true;
|
registered = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ class NetworkAccessManagerFactory;
|
|||||||
class QTranslator;
|
class QTranslator;
|
||||||
class QActionGroup;
|
class QActionGroup;
|
||||||
class QMenuBar;
|
class QMenuBar;
|
||||||
class QSplitter;
|
|
||||||
|
|
||||||
class QDeclarativeViewer
|
class QDeclarativeViewer
|
||||||
: public QMainWindow
|
: public QMainWindow
|
||||||
@@ -75,7 +74,7 @@ class QDeclarativeViewer
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QDeclarativeViewer(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
QDeclarativeViewer(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||||
~QDeclarativeViewer();
|
~QDeclarativeViewer();
|
||||||
|
|
||||||
static void registerTypes();
|
static void registerTypes();
|
||||||
@@ -88,7 +87,8 @@ public:
|
|||||||
SaveOnExit = 0x00000010,
|
SaveOnExit = 0x00000010,
|
||||||
ExitOnComplete = 0x00000020,
|
ExitOnComplete = 0x00000020,
|
||||||
ExitOnFailure = 0x00000040,
|
ExitOnFailure = 0x00000040,
|
||||||
Snapshot = 0x00000080
|
Snapshot = 0x00000080,
|
||||||
|
TestSkipProperty = 0x00000100
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(ScriptOptions, ScriptOption)
|
Q_DECLARE_FLAGS(ScriptOptions, ScriptOption)
|
||||||
void setScript(const QString &s) { m_script = s; }
|
void setScript(const QString &s) { m_script = s; }
|
||||||
@@ -111,6 +111,7 @@ public:
|
|||||||
|
|
||||||
QDeclarativeView *view() const;
|
QDeclarativeView *view() const;
|
||||||
LoggerWidget *warningsWidget() const;
|
LoggerWidget *warningsWidget() const;
|
||||||
|
QString currentFile() const { return currentFileOrUrl; }
|
||||||
|
|
||||||
void enableExperimentalGestures();
|
void enableExperimentalGestures();
|
||||||
|
|
||||||
@@ -119,6 +120,7 @@ public slots:
|
|||||||
void sceneResized(QSize size);
|
void sceneResized(QSize size);
|
||||||
bool open(const QString&);
|
bool open(const QString&);
|
||||||
void openFile();
|
void openFile();
|
||||||
|
void openUrl();
|
||||||
void reload();
|
void reload();
|
||||||
void takeSnapShot();
|
void takeSnapShot();
|
||||||
void toggleRecording();
|
void toggleRecording();
|
||||||
@@ -163,7 +165,6 @@ private:
|
|||||||
QString getVideoFileName();
|
QString getVideoFileName();
|
||||||
|
|
||||||
LoggerWidget *loggerWindow;
|
LoggerWidget *loggerWindow;
|
||||||
|
|
||||||
QDeclarativeView *canvas;
|
QDeclarativeView *canvas;
|
||||||
QmlJSDebugger::QDeclarativeViewObserver *observer;
|
QmlJSDebugger::QDeclarativeViewObserver *observer;
|
||||||
QSize initialSize;
|
QSize initialSize;
|
||||||
@@ -183,8 +184,6 @@ private:
|
|||||||
int record_autotime;
|
int record_autotime;
|
||||||
bool devicemode;
|
bool devicemode;
|
||||||
QAction *recordAction;
|
QAction *recordAction;
|
||||||
QString currentSkin;
|
|
||||||
bool scaleSkin;
|
|
||||||
RecordingDialog *recdlg;
|
RecordingDialog *recdlg;
|
||||||
|
|
||||||
void senseImageMagick();
|
void senseImageMagick();
|
||||||
@@ -199,6 +198,7 @@ private:
|
|||||||
QAction *animationStepAction;
|
QAction *animationStepAction;
|
||||||
QAction *animationSetStepAction;
|
QAction *animationSetStepAction;
|
||||||
|
|
||||||
|
QAction *rotateAction;
|
||||||
QActionGroup *orientation;
|
QActionGroup *orientation;
|
||||||
QAction *showWarningsWindow;
|
QAction *showWarningsWindow;
|
||||||
QAction *designModeBehaviorAction;
|
QAction *designModeBehaviorAction;
|
||||||
@@ -214,8 +214,6 @@ private:
|
|||||||
|
|
||||||
bool useQmlFileBrowser;
|
bool useQmlFileBrowser;
|
||||||
|
|
||||||
QWidget *m_centralWidget;
|
|
||||||
|
|
||||||
QTranslator *translator;
|
QTranslator *translator;
|
||||||
void loadTranslationFile(const QString& directory);
|
void loadTranslationFile(const QString& directory);
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
<RCC>
|
|
||||||
<qresource prefix="/">
|
|
||||||
<file>content/Browser.qml</file>
|
|
||||||
<file>content/images/up.png</file>
|
|
||||||
<file>content/images/folder.png</file>
|
|
||||||
<file>content/images/titlebar.sci</file>
|
|
||||||
<file>content/images/titlebar.png</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
||||||
179
share/qtcreator/qml/qmlobserver/startup/Logo.qml
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 QtDeclarative module 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$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 1.0
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: myApp
|
||||||
|
width: 411
|
||||||
|
height: 411
|
||||||
|
color: "transparent"
|
||||||
|
property alias logoState : myApp.state
|
||||||
|
signal animationFinished
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: sketchBlueHolder
|
||||||
|
width: sketchLogo.width
|
||||||
|
height: sketchLogo.height
|
||||||
|
Image {
|
||||||
|
id: image1
|
||||||
|
x: -44
|
||||||
|
y: -45
|
||||||
|
smooth: true
|
||||||
|
source: "shadow.png"
|
||||||
|
}
|
||||||
|
Item {
|
||||||
|
clip: true
|
||||||
|
width: sketchLogo.width
|
||||||
|
height: sketchLogo.height
|
||||||
|
Image {
|
||||||
|
id: sketchLogo
|
||||||
|
smooth: true
|
||||||
|
source: "qt-sketch.jpg"
|
||||||
|
}
|
||||||
|
Image {
|
||||||
|
id: blueLogo
|
||||||
|
y: -420
|
||||||
|
smooth: true
|
||||||
|
source: "qt-blue.jpg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "showBlueprint"
|
||||||
|
PropertyChanges {
|
||||||
|
target: blueLogo
|
||||||
|
y: 0
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: sketchLogo
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
extend: "showBlueprint"
|
||||||
|
name: "finale"
|
||||||
|
PropertyChanges {
|
||||||
|
target: fullLogo
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: backLogo
|
||||||
|
opacity: 1
|
||||||
|
scale: 1
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: frontLogo
|
||||||
|
opacity: 1
|
||||||
|
scale: 1
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: qtText
|
||||||
|
opacity: 1
|
||||||
|
scale: 1
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: sketchBlueHolder
|
||||||
|
opacity: 0
|
||||||
|
scale: 1.4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
to: "showBlueprint"
|
||||||
|
SequentialAnimation {
|
||||||
|
NumberAnimation { property: "y"; duration: 600; easing.type: "OutBounce" }
|
||||||
|
PropertyAction { target: sketchLogo; property: "opacity" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition {
|
||||||
|
to: "finale"
|
||||||
|
PropertyAction { target: fullLogo; property: "opacity" }
|
||||||
|
SequentialAnimation {
|
||||||
|
NumberAnimation { target: backLogo; properties: "scale, opacity"; duration: 300 }
|
||||||
|
NumberAnimation { target: frontLogo; properties: "scale, opacity"; duration: 300 }
|
||||||
|
ParallelAnimation {
|
||||||
|
NumberAnimation { target: qtText; properties: "opacity, scale"; duration: 400; easing.type: "OutQuad" }
|
||||||
|
NumberAnimation { target: sketchBlueHolder; property: "opacity"; duration: 300; easing.type: "OutQuad" }
|
||||||
|
NumberAnimation { target: sketchBlueHolder; property: "scale"; duration: 320; easing.type: "OutQuad" }
|
||||||
|
}
|
||||||
|
PauseAnimation { duration: 1000 }
|
||||||
|
ScriptAction { script: myApp.animationFinished() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: fullLogo
|
||||||
|
opacity: 0
|
||||||
|
Image {
|
||||||
|
id: backLogo
|
||||||
|
x: -16
|
||||||
|
y: -41
|
||||||
|
opacity: 0
|
||||||
|
scale: 0.7
|
||||||
|
smooth: true
|
||||||
|
source: "qt-back.png"
|
||||||
|
}
|
||||||
|
Image {
|
||||||
|
id: frontLogo
|
||||||
|
x: -17
|
||||||
|
y: -41
|
||||||
|
opacity: 0
|
||||||
|
scale: 1.2
|
||||||
|
smooth: true
|
||||||
|
source: "qt-front.png"
|
||||||
|
}
|
||||||
|
Image {
|
||||||
|
id: qtText
|
||||||
|
x: -10
|
||||||
|
y: -41
|
||||||
|
opacity: 0
|
||||||
|
scale: 1.2
|
||||||
|
smooth: true
|
||||||
|
source: "qt-text.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
share/qtcreator/qml/qmlobserver/startup/qt-back.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
share/qtcreator/qml/qmlobserver/startup/qt-blue.jpg
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
share/qtcreator/qml/qmlobserver/startup/qt-front.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
share/qtcreator/qml/qmlobserver/startup/qt-sketch.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
share/qtcreator/qml/qmlobserver/startup/qt-text.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
share/qtcreator/qml/qmlobserver/startup/quick-blur.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
share/qtcreator/qml/qmlobserver/startup/quick-regular.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
share/qtcreator/qml/qmlobserver/startup/shadow.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
173
share/qtcreator/qml/qmlobserver/startup/startup.qml
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 QtDeclarative module 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$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 1.0
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: treatsApp
|
||||||
|
width: 800
|
||||||
|
height: 480
|
||||||
|
color: "darkgrey"
|
||||||
|
Component.onCompleted: treatsApp.state = "part1"
|
||||||
|
signal animationFinished
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: 800
|
||||||
|
height: 480
|
||||||
|
anchors.centerIn: parent
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
Logo {
|
||||||
|
id: logo
|
||||||
|
x: 165
|
||||||
|
y: 35
|
||||||
|
rotation: -15
|
||||||
|
scale: 0.6
|
||||||
|
opacity: 0
|
||||||
|
onAnimationFinished: treatsApp.animationFinished();
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: quickblur
|
||||||
|
x: 800//325
|
||||||
|
y: 344
|
||||||
|
Image {
|
||||||
|
id: blurText
|
||||||
|
source: "quick-blur.png"
|
||||||
|
}
|
||||||
|
Image {
|
||||||
|
id: quickregular
|
||||||
|
x: -1
|
||||||
|
y: 0
|
||||||
|
opacity: 0
|
||||||
|
source: "quick-regular.png"
|
||||||
|
}
|
||||||
|
Image {
|
||||||
|
id: star
|
||||||
|
x: -1
|
||||||
|
y: 0
|
||||||
|
opacity: 0
|
||||||
|
source: "white-star.png"
|
||||||
|
smooth: true
|
||||||
|
NumberAnimation on rotation {
|
||||||
|
from: 0
|
||||||
|
to: 360
|
||||||
|
loops: NumberAnimation.Infinite
|
||||||
|
running: true
|
||||||
|
duration: 2000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "part1"
|
||||||
|
PropertyChanges {
|
||||||
|
target: logo
|
||||||
|
scale: 0.8
|
||||||
|
opacity: 1
|
||||||
|
rotation: 0
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: treatsApp
|
||||||
|
color: "black"
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: logo
|
||||||
|
y: 10
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: quickblur
|
||||||
|
x: logo.x + 145
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: blurText
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: quickregular
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: star
|
||||||
|
x: -7
|
||||||
|
y: -37
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
ParallelAnimation {
|
||||||
|
NumberAnimation { target: logo; property: "opacity"; duration: 500 }
|
||||||
|
NumberAnimation { target: logo; property: "scale"; duration: 4000; }
|
||||||
|
NumberAnimation { target: logo; property: "rotation"; duration: 2000; easing.type: "OutBack"}
|
||||||
|
ColorAnimation { duration: 3000}
|
||||||
|
SequentialAnimation {
|
||||||
|
PauseAnimation { duration: 1000 }
|
||||||
|
ScriptAction { script: logo.logoState = "showBlueprint" }
|
||||||
|
PauseAnimation { duration: 800 }
|
||||||
|
ScriptAction { script: logo.logoState = "finale" }
|
||||||
|
PauseAnimation { duration: 800 }
|
||||||
|
ParallelAnimation {
|
||||||
|
NumberAnimation { target: quickblur; property: "x"; duration: 200;}
|
||||||
|
SequentialAnimation {
|
||||||
|
PauseAnimation { duration: 200}
|
||||||
|
ParallelAnimation {
|
||||||
|
NumberAnimation { target: blurText; property: "opacity"; duration: 300;}
|
||||||
|
NumberAnimation { target: quickregular; property: "opacity"; duration: 300;}
|
||||||
|
}
|
||||||
|
NumberAnimation { target: star; property: "opacity"; from: 0; to: 1; duration: 500 }
|
||||||
|
PauseAnimation { duration: 200 }
|
||||||
|
NumberAnimation { target: star; property: "opacity"; from: 1; to: 0; duration: 500 }
|
||||||
|
}
|
||||||
|
SequentialAnimation {
|
||||||
|
PauseAnimation { duration: 150}
|
||||||
|
NumberAnimation { target: logo; property: "y"; duration: 300; easing.type: "OutBounce" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
} // treatsApp
|
||||||
16
share/qtcreator/qml/qmlobserver/startup/startup.qrc
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/startup">
|
||||||
|
<file>Logo.qml</file>
|
||||||
|
<file>qt-back.png</file>
|
||||||
|
<file>qt-blue.jpg</file>
|
||||||
|
<file>qt-front.png</file>
|
||||||
|
<file>qt-sketch.jpg</file>
|
||||||
|
<file>qt-text.png</file>
|
||||||
|
<file>quick-blur.png</file>
|
||||||
|
<file>quick-regular.png</file>
|
||||||
|
<file>shadow.png</file>
|
||||||
|
<file>startup.qml</file>
|
||||||
|
<file>startup.qrc</file>
|
||||||
|
<file>white-star.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
BIN
share/qtcreator/qml/qmlobserver/startup/white-star.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |