summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-01-31 16:52:36 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-03 00:39:18 +0100
commit01dc7e2ea476e0e6dcdce2e72979bbc858f4057d (patch)
treed8796f7695bbf8ad42abf47cd84c1b5e000ef795 /tools
parent5e07b57b818326da47a46d384415041fa4cea0ba (diff)
Remove QtQuick1 elements from qtdeclarative
QtQuick1 is now contained in a separate repository. Task-number: QTBUG-23737 Change-Id: I09eae67af5693a22b896b916f816f73ccc3a89b1 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlplugindump/main.cpp27
-rw-r--r--tools/qmlplugindump/qmlplugindump.pro1
-rw-r--r--tools/qmlscene/main.cpp97
-rw-r--r--tools/qmlviewer/Info_mac.plist49
-rw-r--r--tools/qmlviewer/browser/Browser.qml318
-rw-r--r--tools/qmlviewer/browser/browser.qrc9
-rw-r--r--tools/qmlviewer/browser/images/folder.pngbin1841 -> 0 bytes
-rw-r--r--tools/qmlviewer/browser/images/titlebar.pngbin1436 -> 0 bytes
-rw-r--r--tools/qmlviewer/browser/images/titlebar.sci5
-rw-r--r--tools/qmlviewer/browser/images/up.pngbin662 -> 0 bytes
-rw-r--r--tools/qmlviewer/deviceorientation.cpp80
-rw-r--r--tools/qmlviewer/deviceorientation.h84
-rw-r--r--tools/qmlviewer/deviceorientation_harmattan.cpp161
-rw-r--r--tools/qmlviewer/loggerwidget.cpp201
-rw-r--r--tools/qmlviewer/loggerwidget.h101
-rw-r--r--tools/qmlviewer/main.cpp566
-rw-r--r--tools/qmlviewer/proxysettings.cpp109
-rw-r--r--tools/qmlviewer/proxysettings.h71
-rw-r--r--tools/qmlviewer/proxysettings.ui115
-rw-r--r--tools/qmlviewer/qdeclarativetester.cpp450
-rw-r--r--tools/qmlviewer/qdeclarativetester.h290
-rw-r--r--tools/qmlviewer/qml.icnsbin196156 -> 0 bytes
-rw-r--r--tools/qmlviewer/qml.pri32
-rw-r--r--tools/qmlviewer/qmlruntime.cpp1351
-rw-r--r--tools/qmlviewer/qmlruntime.h205
-rw-r--r--tools/qmlviewer/qmlviewer.pro26
-rw-r--r--tools/qmlviewer/recopts.ui513
-rw-r--r--tools/qmlviewer/startup/Logo.qml179
-rw-r--r--tools/qmlviewer/startup/qt-back.pngbin3549 -> 0 bytes
-rw-r--r--tools/qmlviewer/startup/qt-blue.jpgbin20900 -> 0 bytes
-rw-r--r--tools/qmlviewer/startup/qt-front.pngbin3318 -> 0 bytes
-rw-r--r--tools/qmlviewer/startup/qt-sketch.jpgbin17048 -> 0 bytes
-rw-r--r--tools/qmlviewer/startup/qt-text.pngbin14565 -> 0 bytes
-rw-r--r--tools/qmlviewer/startup/quick-blur.pngbin2826 -> 0 bytes
-rw-r--r--tools/qmlviewer/startup/quick-regular.pngbin1399 -> 0 bytes
-rw-r--r--tools/qmlviewer/startup/shadow.pngbin1592 -> 0 bytes
-rw-r--r--tools/qmlviewer/startup/startup.qml173
-rw-r--r--tools/qmlviewer/startup/startup.qrc16
-rw-r--r--tools/qmlviewer/startup/white-star.pngbin2651 -> 0 bytes
-rw-r--r--tools/tools.pro2
40 files changed, 51 insertions, 5180 deletions
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index afbc4a16e2..ad8a3a6d64 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -45,10 +45,6 @@
#include <QtQuick/private/qquickevents_p_p.h>
#include <QtQuick/private/qquickpincharea_p.h>
-#ifdef QT_WIDGETS_LIB
-#include <QtWidgets/QApplication>
-#endif
-
#include <QtGui/QGuiApplication>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
@@ -84,8 +80,8 @@ void collectReachableMetaObjects(const QMetaObject *meta, QSet<const QMetaObject
if (! meta || metas->contains(meta))
return;
- // dynamic meta objects can break things badly (like QDeclarative1VisualDataModelParts)
- // but extended types are usually fine (like QDeclarative1GraphicsWidget)
+ // dynamic meta objects can break things badly
+ // but extended types are usually fine
const QMetaObjectPrivate *mop = reinterpret_cast<const QMetaObjectPrivate *>(meta->d.data);
if (extended || !(mop->flags & DynamicMetaObject))
metas->insert(meta);
@@ -611,11 +607,7 @@ int main(int argc, char *argv[])
QtSimulatorPrivate::SimulatorConnection::createStubInstance();
#endif
-#ifdef QT_WIDGETS_LIB
- QApplication app(argc, argv);
-#else
QGuiApplication app(argc, argv);
-#endif
const QStringList args = app.arguments();
const QString appName = QFileInfo(app.applicationFilePath()).baseName();
if (args.size() < 2) {
@@ -687,21 +679,6 @@ int main(int argc, char *argv[])
engine.addImportPath(pluginImportPath);
}
-#ifdef QT_WIDGETS_LIB
- // load the QtQuick 1 plugin
- {
- QByteArray code("import QtQuick 1.0\nQtObject {}");
- QDeclarativeComponent c(&engine);
- c.setData(code, QUrl::fromLocalFile(pluginImportPath + "/loadqtquick1.qml"));
- c.create();
- if (!c.errors().isEmpty()) {
- foreach (const QDeclarativeError &error, c.errors())
- qWarning() << error.toString();
- return EXIT_IMPORTERROR;
- }
- }
-#endif
-
// load the QtQuick 2 plugin
{
QByteArray code("import QtQuick 2.0\nQtObject {}");
diff --git a/tools/qmlplugindump/qmlplugindump.pro b/tools/qmlplugindump/qmlplugindump.pro
index 25c0037129..e1c8485e27 100644
--- a/tools/qmlplugindump/qmlplugindump.pro
+++ b/tools/qmlplugindump/qmlplugindump.pro
@@ -3,7 +3,6 @@ CONFIG += qt uic console
DESTDIR = $$QT.declarative.bins
QT += declarative declarative-private quick-private core-private
-!isEmpty(QT.widgets.name):!isEmpty(QT.qtquick1.name): QT += widgets qtquick1
TARGET = qmlplugindump
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index 6138e38134..115dace0b6 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -241,54 +241,53 @@ static int displayOptionsDialog(Options *options)
}
#endif
-static void checkAndAdaptVersion(const QUrl &url)
+static bool checkVersion(const QUrl &url)
{
if (!qgetenv("QMLSCENE_IMPORT_NAME").isEmpty()) {
- return;
+ qWarning("QMLSCENE_IMPORT_NAME is no longer supported.");
}
QString fileName = url.toLocalFile();
- if (fileName.isEmpty())
- return;
+ if (fileName.isEmpty()) {
+ qWarning("qmlscene: filename required.");
+ return false;
+ }
QFile f(fileName);
if (!f.open(QFile::ReadOnly | QFile::Text)) {
qWarning("qmlscene: failed to check version of file '%s', could not open...",
qPrintable(fileName));
- return;
+ return false;
}
- QRegExp quick1("^\\s*import +QtQuick +1\\.");
- QRegExp quick2("^\\s*import +QtQuick +2\\.");
+ QRegExp quick1("^\\s*import +QtQuick +1\\.\\w*");
QRegExp qt47("^\\s*import +Qt +4\\.7");
- QString envToWrite;
- QString compat;
-
QTextStream stream(&f);
bool codeFound= false;
while (!codeFound) {
QString line = stream.readLine();
- if (line.contains("{"))
+ if (line.contains("{")) {
codeFound = true;
- if (envToWrite.isEmpty() && quick1.indexIn(line) >= 0) {
- envToWrite = QLatin1String("quick1");
- compat = QLatin1String("QtQuick 1.0");
- } else if (envToWrite.isEmpty() && qt47.indexIn(line) >= 0) {
- envToWrite = QLatin1String("qt");
- compat = QLatin1String("Qt 4.7");
- } else if (quick2.indexIn(line) >= 0) {
- envToWrite.clear();
- compat.clear();
- break;
+ } else {
+ QString import;
+ if (quick1.indexIn(line) >= 0) {
+ import = quick1.cap(0).trimmed();
+ } else if (qt47.indexIn(line) >= 0) {
+ import = qt47.cap(0).trimmed();
+ }
+
+ if (!import.isNull()) {
+ qWarning("qmlscene: '%s' is no longer supported.\n"
+ "Use qmlviewer to load file '%s'.",
+ qPrintable(import),
+ qPrintable(fileName));
+ return false;
+ }
}
}
- if (!envToWrite.isEmpty()) {
- qWarning("qmlscene: Autodetecting compatibility import \"%s\"...", qPrintable(compat));
- if (qgetenv("QMLSCENE_IMPORT_NAME").isEmpty())
- qputenv("QMLSCENE_IMPORT_NAME", envToWrite.toLatin1().constData());
- }
+ return true;
}
static void displayFileDialog(Options *options)
@@ -398,36 +397,36 @@ int main(int argc, char ** argv)
int exitCode = 0;
if (!options.file.isEmpty()) {
- if (options.versionDetection)
- checkAndAdaptVersion(options.file);
- QQuickView *qxView = new MyQQuickView();
- engine = qxView->engine();
- for (int i = 0; i < imports.size(); ++i)
- engine->addImportPath(imports.at(i));
- window = qxView;
- if (options.file.isLocalFile()) {
- QFileInfo fi(options.file.toLocalFile());
- loadDummyDataFiles(*engine, fi.path());
- }
- qxView->setSource(options.file);
+ if (!options.versionDetection || checkVersion(options.file)) {
+ QQuickView *qxView = new MyQQuickView();
+ engine = qxView->engine();
+ for (int i = 0; i < imports.size(); ++i)
+ engine->addImportPath(imports.at(i));
+ window = qxView;
+ if (options.file.isLocalFile()) {
+ QFileInfo fi(options.file.toLocalFile());
+ loadDummyDataFiles(*engine, fi.path());
+ }
+ qxView->setSource(options.file);
- QObject::connect(engine, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
+ QObject::connect(engine, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
- window->setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
- if (options.fullscreen)
- window->showFullScreen();
- else if (options.maximized)
- window->showMaximized();
- else
- window->show();
+ window->setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
+ if (options.fullscreen)
+ window->showFullScreen();
+ else if (options.maximized)
+ window->showMaximized();
+ else
+ window->show();
- exitCode = app.exec();
+ exitCode = app.exec();
- delete window;
+ delete window;
#ifdef QML_RUNTIME_TESTING
- RenderStatistics::printTotalStats();
+ RenderStatistics::printTotalStats();
#endif
+ }
}
return exitCode;
diff --git a/tools/qmlviewer/Info_mac.plist b/tools/qmlviewer/Info_mac.plist
deleted file mode 100644
index 08775479ba..0000000000
--- a/tools/qmlviewer/Info_mac.plist
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
-<plist version="0.1">
-<dict>
- <key>CFBundleIconFile</key>
- <string>@ICON@</string>
- <key>CFBundleIdentifier</key>
- <string>com.nokia.qt.qml</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleGetInfoString</key>
- <string>Created by Qt/QMake</string>
- <key>CFBundleSignature</key>
- <string>@TYPEINFO@</string>
- <key>CFBundleExecutable</key>
- <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>
-</plist>
diff --git a/tools/qmlviewer/browser/Browser.qml b/tools/qmlviewer/browser/Browser.qml
deleted file mode 100644
index f2cc4a858a..0000000000
--- a/tools/qmlviewer/browser/Browser.qml
+++ /dev/null
@@ -1,318 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import Qt.labs.folderlistmodel 1.0
-
-Rectangle {
- id: root
- property bool showFocusHighlight: false
- property variant folders: folders1
- property variant view: view1
- width: 320
- height: 480
- color: palette.window
-
- FolderListModel {
- id: folders1
- nameFilters: [ "*.qml" ]
- folder: qmlViewerFolder
- }
- FolderListModel {
- id: folders2
- nameFilters: [ "*.qml" ]
- folder: qmlViewerFolder
- }
-
- SystemPalette { id: palette }
-
- function down(path) {
- if (folders == folders1) {
- view = view2
- folders = folders2;
- view1.state = "exitLeft";
- } else {
- view = view1
- folders = folders1;
- view2.state = "exitLeft";
- }
- view.x = root.width;
- view.state = "current";
- view.focus = true;
- folders.folder = path;
- }
- function up() {
- var path = folders.parentFolder;
- if (folders == folders1) {
- view = view2
- folders = folders2;
- view1.state = "exitRight";
- } else {
- view = view1
- folders = folders1;
- view2.state = "exitRight";
- }
- view.x = -root.width;
- view.state = "current";
- view.focus = true;
- 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 {
- id: folderDelegate
- Rectangle {
- id: wrapper
- function launch() {
- if (folders.isFolder(index)) {
- down(filePath);
- } else {
- qmlViewer.launch(filePath);
- }
- }
- width: root.width
- height: 52
- color: "transparent"
- Rectangle {
- id: highlight; visible: false
- anchors.fill: parent
- color: palette.highlight
- gradient: Gradient {
- GradientStop { id: t1; position: 0.0; color: palette.highlight }
- GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) }
- }
- }
- Item {
- width: 48; height: 48
- Image { source: "images/folder.png"; anchors.centerIn: parent; visible: folders.isFolder(index)}
- }
- Text {
- id: nameText
- anchors.fill: parent; verticalAlignment: Text.AlignVCenter
- text: fileName
- anchors.leftMargin: 54
- font.pixelSize: 32
- color: (wrapper.ListView.isCurrentItem && root.showFocusHighlight) ? palette.highlightedText : palette.windowText
- elide: Text.ElideRight
- }
- MouseArea {
- id: mouseRegion
- anchors.fill: parent
- onPressed: {
- root.showFocusHighlight = false;
- wrapper.ListView.view.currentIndex = index;
- }
- onClicked: { if (folders == wrapper.ListView.view.model) launch() }
- }
- states: [
- State {
- name: "pressed"
- when: mouseRegion.pressed
- PropertyChanges { target: highlight; visible: true }
- PropertyChanges { target: nameText; color: palette.highlightedText }
- }
- ]
- }
- }
-
- ListView {
- id: view1
- anchors.top: titleBar.bottom
- anchors.bottom: parent.bottom
- x: 0
- width: parent.width
- model: folders1
- delegate: folderDelegate
- 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
- pressDelay: 100
- focus: true
- state: "current"
- states: [
- State {
- name: "current"
- PropertyChanges { target: view1; x: 0 }
- },
- State {
- name: "exitLeft"
- PropertyChanges { target: view1; x: -root.width }
- },
- State {
- name: "exitRight"
- PropertyChanges { target: view1; x: root.width }
- }
- ]
- transitions: [
- Transition {
- to: "current"
- SequentialAnimation {
- NumberAnimation { properties: "x"; duration: 250 }
- }
- },
- Transition {
- NumberAnimation { properties: "x"; duration: 250 }
- NumberAnimation { properties: "x"; duration: 250 }
- }
- ]
- Keys.onPressed: root.keyPressed(event.key)
- }
-
- ListView {
- id: view2
- anchors.top: titleBar.bottom
- anchors.bottom: parent.bottom
- x: parent.width
- width: parent.width
- model: folders2
- delegate: folderDelegate
- 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
- pressDelay: 100
- states: [
- State {
- name: "current"
- PropertyChanges { target: view2; x: 0 }
- },
- State {
- name: "exitLeft"
- PropertyChanges { target: view2; x: -root.width }
- },
- State {
- name: "exitRight"
- PropertyChanges { target: view2; x: root.width }
- }
- ]
- transitions: [
- Transition {
- to: "current"
- SequentialAnimation {
- NumberAnimation { properties: "x"; duration: 250 }
- }
- },
- Transition {
- NumberAnimation { properties: "x"; duration: 250 }
- }
- ]
- Keys.onPressed: root.keyPressed(event.key)
- }
-
- Keys.onPressed: {
- root.keyPressed(event.key);
- if (event.key == Qt.Key_Return || event.key == Qt.Key_Select || event.key == Qt.Key_Right) {
- view.currentItem.launch();
- event.accepted = true;
- } else if (event.key == Qt.Key_Left) {
- up();
- }
- }
-
- BorderImage {
- source: "images/titlebar.sci";
- width: parent.width;
- height: 52
- y: -7
- id: titleBar
-
- Rectangle {
- id: upButton
- width: 48
- height: titleBar.height - 7
- color: "transparent"
-
- Image { anchors.centerIn: parent; source: "images/up.png" }
- MouseArea { id: upRegion; anchors.centerIn: parent
- width: 56
- height: 56
- onClicked: if (folders.parentFolder != "") up()
- }
- states: [
- State {
- name: "pressed"
- when: upRegion.pressed
- PropertyChanges { target: upButton; color: palette.highlight }
- }
- ]
- }
- Rectangle {
- color: "gray"
- x: 48
- width: 1
- height: 44
- }
-
- Text {
- anchors.left: upButton.right; anchors.right: parent.right; height: parent.height
- anchors.leftMargin: 4; anchors.rightMargin: 4
- text: folders.folder
- color: "white"
- elide: Text.ElideLeft; horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignVCenter
- font.pixelSize: 32
- }
- }
-}
diff --git a/tools/qmlviewer/browser/browser.qrc b/tools/qmlviewer/browser/browser.qrc
deleted file mode 100644
index 9c688e7521..0000000000
--- a/tools/qmlviewer/browser/browser.qrc
+++ /dev/null
@@ -1,9 +0,0 @@
-<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>
diff --git a/tools/qmlviewer/browser/images/folder.png b/tools/qmlviewer/browser/images/folder.png
deleted file mode 100644
index e53e2ad464..0000000000
--- a/tools/qmlviewer/browser/images/folder.png
+++ /dev/null
Binary files differ
diff --git a/tools/qmlviewer/browser/images/titlebar.png b/tools/qmlviewer/browser/images/titlebar.png
deleted file mode 100644
index 51c90082d0..0000000000
--- a/tools/qmlviewer/browser/images/titlebar.png
+++ /dev/null
Binary files differ
diff --git a/tools/qmlviewer/browser/images/titlebar.sci b/tools/qmlviewer/browser/images/titlebar.sci
deleted file mode 100644
index 0418d94cd6..0000000000
--- a/tools/qmlviewer/browser/images/titlebar.sci
+++ /dev/null
@@ -1,5 +0,0 @@
-border.left: 10
-border.top: 12
-border.bottom: 12
-border.right: 10
-source: titlebar.png
diff --git a/tools/qmlviewer/browser/images/up.png b/tools/qmlviewer/browser/images/up.png
deleted file mode 100644
index b05f8025d0..0000000000
--- a/tools/qmlviewer/browser/images/up.png
+++ /dev/null
Binary files differ
diff --git a/tools/qmlviewer/deviceorientation.cpp b/tools/qmlviewer/deviceorientation.cpp
deleted file mode 100644
index edb9dbb45a..0000000000
--- a/tools/qmlviewer/deviceorientation.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "deviceorientation.h"
-
-QT_USE_NAMESPACE
-
-class DefaultDeviceOrientation : public DeviceOrientation
-{
- Q_OBJECT
-public:
- DefaultDeviceOrientation() : DeviceOrientation(), m_orientation(DeviceOrientation::Portrait) {}
-
- Orientation orientation() const {
- return m_orientation;
- }
-
- void pauseListening() {
- }
- void resumeListening() {
- }
-
- void setOrientation(Orientation o) {
- if (o != m_orientation) {
- m_orientation = o;
- emit orientationChanged();
- }
- }
-
- Orientation m_orientation;
-};
-
-DeviceOrientation* DeviceOrientation::instance()
-{
- static DefaultDeviceOrientation *o = 0;
- if (!o)
- o = new DefaultDeviceOrientation;
- return o;
-}
-
-#include "deviceorientation.moc"
-
diff --git a/tools/qmlviewer/deviceorientation.h b/tools/qmlviewer/deviceorientation.h
deleted file mode 100644
index f74be746c6..0000000000
--- a/tools/qmlviewer/deviceorientation.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ORIENTATION_H
-#define ORIENTATION_H
-
-#include <QObject>
-
-QT_BEGIN_NAMESPACE
-
-class DeviceOrientationPrivate;
-class DeviceOrientation : public QObject
-{
- Q_OBJECT
- Q_ENUMS(Orientation)
-public:
- enum Orientation {
- UnknownOrientation,
- Portrait,
- Landscape,
- PortraitInverted,
- LandscapeInverted
- };
-
- virtual Orientation orientation() const = 0;
- virtual void setOrientation(Orientation) = 0;
-
- virtual void pauseListening() = 0;
- virtual void resumeListening() = 0;
-
- static DeviceOrientation *instance();
-
-signals:
- void orientationChanged();
-
-protected:
- DeviceOrientation() {}
-
-private:
- DeviceOrientationPrivate *d_ptr;
- friend class DeviceOrientationPrivate;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/tools/qmlviewer/deviceorientation_harmattan.cpp b/tools/qmlviewer/deviceorientation_harmattan.cpp
deleted file mode 100644
index e82c139054..0000000000
--- a/tools/qmlviewer/deviceorientation_harmattan.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "deviceorientation.h"
-#include <QtDBus>
-#include <QDebug>
-
-#define ORIENTATION_SERVICE QStringLiteral("com.nokia.SensorService")
-#define ORIENTATION_PATH QStringLiteral("/org/maemo/contextkit/Screen/TopEdge")
-#define CONTEXT_INTERFACE QStringLiteral("org.maemo.contextkit.Property")
-#define CONTEXT_CHANGED QStringLiteral("ValueChanged")
-#define CONTEXT_SUBSCRIBE QStringLiteral("Subscribe")
-#define CONTEXT_UNSUBSCRIBE QStringLiteral("Unsubscribe")
-#define CONTEXT_GET QStringLiteral("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 == QLatin1String("top"))
- return Landscape;
- else if (nativeOrientation == QLatin1String("left"))
- return Portrait;
- else if (nativeOrientation == QLatin1String("bottom"))
- return LandscapeInverted;
- else if (nativeOrientation == QLatin1String("right"))
- return PortraitInverted;
- return UnknownOrientation;
- }
-
-private:
- Orientation o;
- bool sensorEnabled;
-};
-
-DeviceOrientation* DeviceOrientation::instance()
-{
- static HarmattanOrientation *o = new HarmattanOrientation;
- return o;
-}
-
-#include "deviceorientation_harmattan.moc"
diff --git a/tools/qmlviewer/loggerwidget.cpp b/tools/qmlviewer/loggerwidget.cpp
deleted file mode 100644
index 02ee8c6d6b..0000000000
--- a/tools/qmlviewer/loggerwidget.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qglobal.h>
-#include <QDebug>
-#include <QSettings>
-#include <QActionGroup>
-#include <QMenu>
-#include <QPlainTextEdit>
-#include <QLabel>
-#include <QVBoxLayout>
-
-#include "loggerwidget.h"
-
-QT_BEGIN_NAMESPACE
-
-LoggerWidget::LoggerWidget(QWidget *parent) :
- QMainWindow(parent),
- m_visibilityOrigin(SettingsOrigin)
-{
- setAttribute(Qt::WA_QuitOnClose, false);
- setWindowTitle(tr("Warnings"));
-
- m_plainTextEdit = new QPlainTextEdit();
- setCentralWidget(m_plainTextEdit);
- m_noWarningsLabel = new QLabel(m_plainTextEdit);
- m_noWarningsLabel->setText(tr("(No warnings)"));
- m_noWarningsLabel->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(m_noWarningsLabel);
- m_plainTextEdit->setLayout(layout);
- connect(m_plainTextEdit, SIGNAL(textChanged()), this, SLOT(updateNoWarningsLabel()));
-
- readSettings();
- setupPreferencesMenu();
-}
-
-void LoggerWidget::append(const QString &msg)
-{
- m_plainTextEdit->appendPlainText(msg);
-
- if (!isVisible() && (defaultVisibility() == AutoShowWarnings))
- setVisible(true);
-}
-
-LoggerWidget::Visibility LoggerWidget::defaultVisibility() const
-{
- return m_visibility;
-}
-
-void LoggerWidget::setDefaultVisibility(LoggerWidget::Visibility visibility)
-{
- if (m_visibility == visibility)
- return;
-
- m_visibility = visibility;
- m_visibilityOrigin = CommandLineOrigin;
-
- m_preferencesMenu->setEnabled(m_visibilityOrigin == SettingsOrigin);
-}
-
-QMenu *LoggerWidget::preferencesMenu()
-{
- return m_preferencesMenu;
-}
-
-QAction *LoggerWidget::showAction()
-{
- return m_showWidgetAction;
-}
-
-void LoggerWidget::readSettings()
-{
- QSettings settings;
- QString warningsPreferences = settings.value(QLatin1String("warnings"), QLatin1String("hide")).toString();
- if (warningsPreferences == QLatin1String("show")) {
- m_visibility = ShowWarnings;
- } else if (warningsPreferences == QLatin1String("hide")) {
- m_visibility = HideWarnings;
- } else {
- m_visibility = AutoShowWarnings;
- }
-}
-
-void LoggerWidget::saveSettings()
-{
- if (m_visibilityOrigin != SettingsOrigin)
- return;
-
- QString value = QLatin1String("autoShow");
- if (defaultVisibility() == ShowWarnings) {
- value = QLatin1String("show");
- } else if (defaultVisibility() == HideWarnings) {
- value = QLatin1String("hide");
- }
-
- QSettings settings;
- settings.setValue(QLatin1String("warnings"), value);
-}
-
-void LoggerWidget::warningsPreferenceChanged(QAction *action)
-{
- Visibility newSetting = static_cast<Visibility>(action->data().toInt());
- m_visibility = newSetting;
- saveSettings();
-}
-
-void LoggerWidget::showEvent(QShowEvent *event)
-{
- QWidget::showEvent(event);
- emit opened();
-}
-
-void LoggerWidget::closeEvent(QCloseEvent *event)
-{
- QWidget::closeEvent(event);
- emit closed();
-}
-
-void LoggerWidget::setupPreferencesMenu()
-{
- m_preferencesMenu = new QMenu(tr("Warnings"));
- QActionGroup *warnings = new QActionGroup(m_preferencesMenu);
- warnings->setExclusive(true);
-
- connect(warnings, SIGNAL(triggered(QAction*)), this, SLOT(warningsPreferenceChanged(QAction*)));
-
- QAction *showWarningsPreference = new QAction(tr("Show by default"), m_preferencesMenu);
- showWarningsPreference->setCheckable(true);
- showWarningsPreference->setData(LoggerWidget::ShowWarnings);
- warnings->addAction(showWarningsPreference);
- m_preferencesMenu->addAction(showWarningsPreference);
-
- QAction *hideWarningsPreference = new QAction(tr("Hide by default"), m_preferencesMenu);
- hideWarningsPreference->setCheckable(true);
- hideWarningsPreference->setData(LoggerWidget::HideWarnings);
- warnings->addAction(hideWarningsPreference);
- m_preferencesMenu->addAction(hideWarningsPreference);
-
- QAction *autoWarningsPreference = new QAction(tr("Show for first warning"), m_preferencesMenu);
- autoWarningsPreference->setCheckable(true);
- autoWarningsPreference->setData(LoggerWidget::AutoShowWarnings);
- warnings->addAction(autoWarningsPreference);
- m_preferencesMenu->addAction(autoWarningsPreference);
-
- switch (defaultVisibility()) {
- case LoggerWidget::ShowWarnings:
- showWarningsPreference->setChecked(true);
- break;
- case LoggerWidget::HideWarnings:
- hideWarningsPreference->setChecked(true);
- break;
- default:
- autoWarningsPreference->setChecked(true);
- }
-}
-
-void LoggerWidget::updateNoWarningsLabel()
-{
- m_noWarningsLabel->setVisible(m_plainTextEdit->toPlainText().length() == 0);
-}
-
-QT_END_NAMESPACE
diff --git a/tools/qmlviewer/loggerwidget.h b/tools/qmlviewer/loggerwidget.h
deleted file mode 100644
index 8ec25f0241..0000000000
--- a/tools/qmlviewer/loggerwidget.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LOGGERWIDGET_H
-#define LOGGERWIDGET_H
-
-#include <QMainWindow>
-#include <QMetaType>
-
-QT_BEGIN_NAMESPACE
-
-class QPlainTextEdit;
-class QLabel;
-class QMenu;
-class QAction;
-
-class LoggerWidget : public QMainWindow {
- Q_OBJECT
-public:
- LoggerWidget(QWidget *parent=0);
-
- enum Visibility { ShowWarnings, HideWarnings, AutoShowWarnings };
-
- Visibility defaultVisibility() const;
- void setDefaultVisibility(Visibility visibility);
-
- QMenu *preferencesMenu();
- QAction *showAction();
-
-public slots:
- void append(const QString &msg);
- void updateNoWarningsLabel();
-
-private slots:
- void warningsPreferenceChanged(QAction *action);
- void readSettings();
- void saveSettings();
-
-protected:
- void showEvent(QShowEvent *event);
- void closeEvent(QCloseEvent *event);
-
-signals:
- void opened();
- void closed();
-
-private:
- void setupPreferencesMenu();
-
- QMenu *m_preferencesMenu;
- QAction *m_showWidgetAction;
- QPlainTextEdit *m_plainTextEdit;
- QLabel *m_noWarningsLabel;
- enum ConfigOrigin { CommandLineOrigin, SettingsOrigin };
- ConfigOrigin m_visibilityOrigin;
- Visibility m_visibility;
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(LoggerWidget::Visibility)
-
-#endif // LOGGERWIDGET_H
diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp
deleted file mode 100644
index 58ea4db595..0000000000
--- a/tools/qmlviewer/main.cpp
+++ /dev/null
@@ -1,566 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarative.h"
-#include "qmlruntime.h"
-#include "qdeclarativeengine.h"
-#include "loggerwidget.h"
-#include <QWidget>
-#include <QDir>
-#include <QApplication>
-#include <QTranslator>
-#include <QDebug>
-#include <QMessageBox>
-#include <QAtomicInt>
-#include <QLibraryInfo>
-#include "qdeclarativetester.h"
-
-QT_USE_NAMESPACE
-
-QtMsgHandler systemMsgOutput = 0;
-
-static QDeclarativeViewer *openFile(const QString &fileName);
-static void showViewer(QDeclarativeViewer *viewer);
-
-QString warnings;
-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()) {
- QMessageBox::warning(0, QApplication::translate("QDeclarativeViewer", "Qt QML Viewer"), warnings);
- }
-#endif
- exit(i);
-}
-
-QWeakPointer<LoggerWidget> logger;
-static QAtomicInt recursiveLock(0);
-
-void myMessageOutput(QtMsgType type, const char *msg)
-{
- QString strMsg = QString::fromLatin1(msg);
-
- if (!QCoreApplication::closingDown()) {
- if (!logger.isNull()) {
- if (recursiveLock.testAndSetOrdered(0, 1)) {
- QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg));
- recursiveLock.store(0);
- }
- } else {
- warnings += strMsg;
- warnings += QLatin1Char('\n');
- }
- }
-
- if (systemMsgOutput) {
- systemMsgOutput(type, msg);
- } else { // Unix
- fprintf(stderr, "%s\n", msg);
- fflush(stderr);
- }
-}
-
-static QDeclarativeViewer* globalViewer = 0;
-
-// The qml file that is shown if the user didn't specify a QML file
-QString initialFile = QLatin1String("qrc:/startup/startup.qml");
-
-void usage()
-{
- qWarning("Usage: qmlviewer [options] <filename>");
- qWarning(" ");
- qWarning(" options:");
- qWarning(" -v, -version ............................. display version");
- qWarning(" -frameless ............................... run with no window frame");
- qWarning(" -maximized................................ run maximized");
- qWarning(" -fullscreen............................... run fullscreen");
- qWarning(" -stayontop................................ keep viewer window on top");
- qWarning(" -sizeviewtorootobject .................... the view resizes to the changes in the content");
- qWarning(" -sizerootobjecttoview .................... the content resizes to the changes in the view (default)");
- qWarning(" -qmlbrowser .............................. use a QML-based file browser");
- qWarning(" -warnings [show|hide]..................... show warnings in a separate log window");
- qWarning(" -recordfile <output> ..................... set video recording file");
- qWarning(" - ImageMagick 'convert' for GIF)");
- qWarning(" - png file for raw frames");
- qWarning(" - 'ffmpeg' for other formats");
- qWarning(" -recorddither ordered|threshold|floyd .... set GIF dither recording mode");
- qWarning(" -recordrate <fps> ........................ set recording frame rate");
- qWarning(" -record arg .............................. add a recording process argument");
- qWarning(" -autorecord [from-]<tomilliseconds> ...... set recording to start and stop");
- qWarning(" -devicekeys .............................. use numeric keys (see F1)");
- qWarning(" -dragthreshold <size> .................... set mouse drag threshold size");
- qWarning(" -netcache <size> ......................... set disk cache to size bytes");
- qWarning(" -translation <translationfile> ........... set the language to run in");
- qWarning(" -I <directory> ........................... prepend to the module import search path,");
- qWarning(" display path if <directory> is empty");
- qWarning(" -P <directory> ........................... prepend to the plugin search path");
-#if defined(Q_OS_MAC)
- qWarning(" -no-opengl ............................... don't use a QGLWidget for the viewport");
- qWarning(" -opengl .................................. use a QGLWidget for the viewport (default)");
-#else
- qWarning(" -no-opengl ............................... don't use a QGLWidget for the viewport (default)");
- qWarning(" -opengl .................................. use a QGLWidget for the viewport");
-#endif
- qWarning(" -script <path> ........................... set the script to use");
- qWarning(" -scriptopts <options>|help ............... set the script options to use");
-
- qWarning(" ");
- qWarning(" Press F1 for interactive help");
-
- exitApp(1);
-}
-
-void scriptOptsUsage()
-{
- qWarning("Usage: qmlviewer -scriptopts <option>[,<option>...] ...");
- qWarning(" options:");
- qWarning(" record ................................... record a new script");
- qWarning(" play ..................................... playback an existing script");
- qWarning(" testimages ............................... record images or compare images 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(" only one frame will be recorded or tested");
- qWarning(" exitoncomplete ........................... cleanly exit the viewer on script completion");
- qWarning(" exitonfailure ............................ immediately exit the viewer on script failure");
- qWarning(" saveonexit ............................... save recording on viewer exit");
- qWarning(" ");
- qWarning(" One of record, play or both must be specified.");
-
- exitApp(1);
-}
-
-enum WarningsConfig { ShowWarnings, HideWarnings, DefaultWarnings };
-
-struct ViewerOptions
-{
- ViewerOptions()
- : frameless(false),
- fps(0.0),
- autorecord_from(0),
- autorecord_to(0),
- dither(QLatin1String("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_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 == QLatin1String("-frameless")) {
- opts.frameless = true;
- } else if (arg == QLatin1String("-maximized")) {
- opts.maximized = true;
- } else if (arg == QLatin1String("-fullscreen")) {
- opts.fullScreen = true;
- } else if (arg == QLatin1String("-stayontop")) {
- opts.stayOnTop = true;
- } else if (arg == QLatin1String("-netcache")) {
- if (lastArg) usage();
- opts.cache = arguments.at(++i).toInt();
- } else if (arg == QLatin1String("-recordrate")) {
- if (lastArg) usage();
- opts.fps = arguments.at(++i).toDouble();
- } else if (arg == QLatin1String("-recordfile")) {
- if (lastArg) usage();
- opts.recordfile = arguments.at(++i);
- } else if (arg == QLatin1String("-record")) {
- if (lastArg) usage();
- opts.recordargs << arguments.at(++i);
- } else if (arg == QLatin1String("-recorddither")) {
- if (lastArg) usage();
- opts.dither = arguments.at(++i);
- } else if (arg == QLatin1String("-autorecord")) {
- if (lastArg) usage();
- QString range = arguments.at(++i);
- int dash = range.indexOf(QLatin1Char('-'));
- if (dash > 0)
- opts.autorecord_from = range.left(dash).toInt();
- opts.autorecord_to = range.mid(dash+1).toInt();
- } else if (arg == QLatin1String("-devicekeys")) {
- opts.devkeys = true;
- } else if (arg == QLatin1String("-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 == QLatin1String("-translation")) {
- if (lastArg) usage();
- opts.translationFile = arguments.at(++i);
- } else if (arg == QLatin1String("-no-opengl")) {
- opts.useGL = false;
- } else if (arg == QLatin1String("-opengl")) {
- opts.useGL = true;
- } else if (arg == QLatin1String("-qmlbrowser")) {
- opts.useNativeFileBrowser = false;
- } else if (arg == QLatin1String("-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 == QLatin1String("-I") || arg == QLatin1String("-L")) {
- if (arg == QLatin1String("-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 == QLatin1String("-P")) {
- if (lastArg) usage();
- opts.plugins << arguments.at(++i);
- } else if (arg == QLatin1String("-script")) {
- if (lastArg) usage();
- opts.script = arguments.at(++i);
- } else if (arg == QLatin1String("-scriptopts")) {
- if (lastArg) usage();
- opts.scriptopts = arguments.at(++i);
- } else if (arg == QLatin1String("-savescript")) {
- if (lastArg) usage();
- opts.script = arguments.at(++i);
- opts.runScript = false;
- } else if (arg == QLatin1String("-playscript")) {
- if (lastArg) usage();
- opts.script = arguments.at(++i);
- opts.runScript = true;
- } else if (arg == QLatin1String("-sizeviewtorootobject")) {
- opts.sizeToView = false;
- } else if (arg == QLatin1String("-sizerootobjecttoview")) {
- opts.sizeToView = true;
- } else if (arg == QLatin1String("-experimentalgestures")) {
- opts.experimentalGestures = true;
- } else if (!arg.startsWith(QLatin1Char('-'))) {
- fileNames.append(arg);
- } else if (true || arg == QLatin1String("-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);
- }
-
- 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);
- }
-
- 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)
-{
- systemMsgOutput = qInstallMsgHandler(myMessageOutput);
- Application app(argc, argv);
- app.setApplicationName(QLatin1String("QtQmlViewer"));
- app.setOrganizationName(QLatin1String("Nokia"));
- app.setOrganizationDomain(QLatin1String("nokia.com"));
-
- QDeclarativeViewer::registerTypes();
- QDeclarativeTester::registerTypes();
-
- parseCommandLineOptions(app.arguments());
-
- QTranslator translator;
- QTranslator qtTranslator;
- QString sysLocale = QLocale::system().name();
- if (translator.load(QLatin1String("qmlviewer_") + sysLocale, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
- app.installTranslator(&translator);
- if (qtTranslator.load(QLatin1String("qt_") + sysLocale, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
- app.installTranslator(&qtTranslator);
- } else {
- app.removeTranslator(&translator);
- }
- }
-
- QTranslator qmlTranslator;
- if (!opts.translationFile.isEmpty()) {
- if (qmlTranslator.load(opts.translationFile)) {
- app.installTranslator(&qmlTranslator);
- } else {
- qWarning() << "Could not load the translation file" << opts.translationFile;
- }
- }
-
- if (opts.fullScreen && opts.maximized)
- qWarning() << "Both -fullscreen and -maximized specified. Using -fullscreen.";
-
- if (fileNames.isEmpty()) {
- QFile qmlapp(QLatin1String("qmlapp"));
- if (qmlapp.exists() && qmlapp.open(QFile::ReadOnly)) {
- QString content = QString::fromUtf8(qmlapp.readAll());
- qmlapp.close();
-
- int newline = content.indexOf(QLatin1Char('\n'));
- if (newline >= 0)
- fileNames += content.left(newline);
- else
- fileNames += content;
- }
- }
-
- 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 {
- foreach (const QString &fileName, fileNames)
- openFile(fileName);
- }
-
- QObject::connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
-
- return app.exec();
-}
-
-#include "main.moc"
diff --git a/tools/qmlviewer/proxysettings.cpp b/tools/qmlviewer/proxysettings.cpp
deleted file mode 100644
index 9b0d2a6d61..0000000000
--- a/tools/qmlviewer/proxysettings.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QIntValidator>
-#include <QSettings>
-
-#include "proxysettings.h"
-
-QT_BEGIN_NAMESPACE
-
-ProxySettings::ProxySettings (QWidget * parent)
- : QDialog (parent), Ui::ProxySettings()
-{
- setupUi (this);
- proxyServerEdit->setInputMask(QLatin1String("000.000.000.000;_"));
- QIntValidator *validator = new QIntValidator (0, 9999, this);
- proxyPortEdit->setValidator(validator);
-
- QSettings settings;
- proxyCheckBox->setChecked(settings.value(QLatin1String("http_proxy/use"), 0).toBool());
- proxyServerEdit->insert(settings.value(QLatin1String("http_proxy/hostname")).toString());
- proxyPortEdit->insert(settings.value(QLatin1String("http_proxy/port"), QLatin1String("80")).toString ());
- usernameEdit->insert(settings.value(QLatin1String("http_proxy/username")).toString ());
- passwordEdit->insert(settings.value(QLatin1String("http_proxy/password")).toString ());
-}
-
-ProxySettings::~ProxySettings()
-{
-}
-
-void ProxySettings::accept ()
-{
- QSettings settings;
-
- settings.setValue(QLatin1String("http_proxy/use"), proxyCheckBox->isChecked());
- settings.setValue(QLatin1String("http_proxy/hostname"), proxyServerEdit->text());
- settings.setValue(QLatin1String("http_proxy/port"), proxyPortEdit->text());
- settings.setValue(QLatin1String("http_proxy/username"), usernameEdit->text());
- settings.setValue(QLatin1String("http_proxy/password"), passwordEdit->text());
-
- QDialog::accept ();
-}
-
-QNetworkProxy ProxySettings::httpProxy ()
-{
- QSettings settings;
- QNetworkProxy proxy;
-
- bool proxyInUse = settings.value(QLatin1String("http_proxy/use"), 0).toBool();
- if (proxyInUse) {
- proxy.setType (QNetworkProxy::HttpProxy);
- proxy.setHostName (settings.value(QLatin1String("http_proxy/hostname")).toString());// "192.168.220.5"
- proxy.setPort (settings.value(QLatin1String("http_proxy/port"), 80).toInt()); // 8080
- proxy.setUser (settings.value(QLatin1String("http_proxy/username")).toString());
- proxy.setPassword (settings.value(QLatin1String("http_proxy/password")).toString());
- //QNetworkProxy::setApplicationProxy (proxy);
- }
- else {
- proxy.setType (QNetworkProxy::NoProxy);
- }
- return proxy;
-}
-
-bool ProxySettings::httpProxyInUse()
-{
- QSettings settings;
- return settings.value(QLatin1String("http_proxy/use"), 0).toBool();
-}
-
-QT_END_NAMESPACE
diff --git a/tools/qmlviewer/proxysettings.h b/tools/qmlviewer/proxysettings.h
deleted file mode 100644
index 54a72ab903..0000000000
--- a/tools/qmlviewer/proxysettings.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PROXYSETTINGS_H
-#define PROXYSETTINGS_H
-
-#include <QDialog>
-#include <QNetworkProxy>
-#include "ui_proxysettings.h"
-
-QT_BEGIN_NAMESPACE
-/**
-*/
-class ProxySettings : public QDialog, public Ui::ProxySettings
-{
-
-Q_OBJECT
-
-public:
- ProxySettings(QWidget * parent = 0);
-
- ~ProxySettings();
-
- static QNetworkProxy httpProxy ();
- static bool httpProxyInUse ();
-
-public slots:
- virtual void accept ();
-};
-
-QT_END_NAMESPACE
-
-#endif // PROXYSETTINGS_H
diff --git a/tools/qmlviewer/proxysettings.ui b/tools/qmlviewer/proxysettings.ui
deleted file mode 100644
index 84e39fe03d..0000000000
--- a/tools/qmlviewer/proxysettings.ui
+++ /dev/null
@@ -1,115 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ProxySettings</class>
- <widget class="QDialog" name="ProxySettings">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>318</width>
- <height>199</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Dialog</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="2">
- <widget class="QCheckBox" name="proxyCheckBox">
- <property name="text">
- <string>Use http proxy</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="serverAddressLabel">
- <property name="text">
- <string>Server Address:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="proxyServerEdit"/>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Port:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="proxyPortEdit"/>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="usernameLabel">
- <property name="text">
- <string>Username:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLineEdit" name="usernameEdit"/>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="passwordLabel">
- <property name="text">
- <string>Password:</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QLineEdit" name="passwordEdit">
- <property name="echoMode">
- <enum>QLineEdit::Password</enum>
- </property>
- </widget>
- </item>
- <item row="5" column="0" colspan="2">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>ProxySettings</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>ProxySettings</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/tools/qmlviewer/qdeclarativetester.cpp b/tools/qmlviewer/qdeclarativetester.cpp
deleted file mode 100644
index 09e624e9c5..0000000000
--- a/tools/qmlviewer/qdeclarativetester.cpp
+++ /dev/null
@@ -1,450 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qdeclarativetester.h>
-#include <QDebug>
-#include <QApplication>
-#include <QtQuick1/qdeclarativeview.h>
-#include <QFile>
-#include <QDeclarativeComponent>
-#include <QDir>
-#include <QCryptographicHash>
-#include <private/qabstractanimation_p.h>
-#include <QGraphicsObject>
-#include <QtQuick1/private/qdeclarativeitem_p.h>
-
-QT_BEGIN_NAMESPACE
-
-extern Q_GUI_EXPORT bool qt_applefontsmoothing_enabled;
-
-QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts,
- QDeclarativeView *parent)
-: QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts),
- testscript(0), hasCompleted(false), hasFailed(false)
-{
- parent->viewport()->installEventFilter(this);
- parent->installEventFilter(this);
- QUnifiedTimer::instance()->setConsistentTiming(true);
-
- //Font antialiasing makes tests system-specific, so disable it
- QFont noAA = QApplication::font();
- noAA.setStyleStrategy(QFont::NoAntialias);
- QApplication::setFont(noAA);
-
- if (options & QDeclarativeViewer::Play)
- this->run();
- start();
-}
-
-QDeclarativeTester::~QDeclarativeTester()
-{
- if (!hasFailed &&
- options & QDeclarativeViewer::Record &&
- options & QDeclarativeViewer::SaveOnExit)
- save();
-}
-
-int QDeclarativeTester::duration() const
-{
- return -1;
-}
-
-void QDeclarativeTester::addMouseEvent(Destination dest, QMouseEvent *me)
-{
- MouseEvent e(me);
- e.destination = dest;
- m_mouseEvents << e;
-}
-
-void QDeclarativeTester::addKeyEvent(Destination dest, QKeyEvent *ke)
-{
- KeyEvent e(ke);
- e.destination = dest;
- m_keyEvents << e;
-}
-
-bool QDeclarativeTester::eventFilter(QObject *o, QEvent *e)
-{
- if (!filterEvents)
- return false;
-
- Destination destination;
- if (o == m_view) {
- destination = View;
- } else if (o == m_view->viewport()) {
- destination = ViewPort;
- } else {
- return false;
- }
-
- switch (e->type()) {
- case QEvent::KeyPress:
- case QEvent::KeyRelease:
- addKeyEvent(destination, (QKeyEvent *)e);
- return true;
- case QEvent::MouseButtonPress:
- case QEvent::MouseButtonRelease:
- case QEvent::MouseMove:
- case QEvent::MouseButtonDblClick:
- addMouseEvent(destination, (QMouseEvent *)e);
- return true;
- default:
- break;
- }
- return false;
-}
-
-void QDeclarativeTester::executefailure()
-{
- hasFailed = true;
-
- if (options & QDeclarativeViewer::ExitOnFailure)
- exit(-1);
-}
-
-void QDeclarativeTester::imagefailure()
-{
- hasFailed = true;
-
- if (options & QDeclarativeViewer::ExitOnFailure){
- 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()
-{
- if ((options & QDeclarativeViewer::TestErrorProperty) && !hasFailed) {
- QString e = m_view->rootObject()->property("error").toString();
- if (!e.isEmpty()) {
- qWarning() << "Test failed:" << e;
- hasFailed = true;
- }
- }
-
-
- testSkip();
- if (options & QDeclarativeViewer::ExitOnComplete)
- QApplication::exit(hasFailed?-1:0);
-
- if (hasCompleted)
- return;
- hasCompleted = true;
-
- if (options & QDeclarativeViewer::Play)
- qWarning("Script playback complete");
-}
-
-void QDeclarativeTester::run()
-{
- QDeclarativeComponent c(m_view->engine(), m_script + QLatin1String(".qml"));
-
- testscript = qobject_cast<QDeclarativeVisualTest *>(c.create());
- if (testscript) testscript->setParent(this);
- else { executefailure(); exit(-1); }
- testscriptidx = 0;
-}
-
-void QDeclarativeTester::save()
-{
- QString filename = m_script + QLatin1String(".qml");
- QFileInfo filenameInfo(filename);
- QDir saveDir = filenameInfo.absoluteDir();
- saveDir.mkpath(QLatin1String("."));
-
- QFile file(filename);
- file.open(QIODevice::WriteOnly);
- QTextStream ts(&file);
-
- ts << "import Qt.VisualTest 4.7\n\n";
- ts << "VisualTest {\n";
-
- int imgCount = 0;
- QList<KeyEvent> keyevents = m_savedKeyEvents;
- QList<MouseEvent> mouseevents = m_savedMouseEvents;
- for (int ii = 0; ii < m_savedFrameEvents.count(); ++ii) {
- const FrameEvent &fe = m_savedFrameEvents.at(ii);
- ts << " Frame {\n";
- ts << " msec: " << fe.msec << "\n";
- if (!fe.hash.isEmpty()) {
- ts << " hash: \"" << fe.hash.toHex() << "\"\n";
- } else if (!fe.image.isNull()) {
- QString filename = filenameInfo.baseName() + QLatin1String(".") + QString::number(imgCount) + QLatin1String(".png");
- fe.image.save(m_script + QLatin1String(".") + QString::number(imgCount) + QLatin1String(".png"));
- imgCount++;
- ts << " image: \"" << filename << "\"\n";
- }
- ts << " }\n";
-
- while (!mouseevents.isEmpty() &&
- mouseevents.first().msec == fe.msec) {
- MouseEvent me = mouseevents.takeFirst();
-
- ts << " Mouse {\n";
- ts << " type: " << me.type << "\n";
- ts << " button: " << me.button << "\n";
- ts << " buttons: " << me.buttons << "\n";
- ts << " x: " << me.pos.x() << "; y: " << me.pos.y() << "\n";
- ts << " modifiers: " << me.modifiers << "\n";
- if (me.destination == ViewPort)
- ts << " sendToViewport: true\n";
- ts << " }\n";
- }
-
- while (!keyevents.isEmpty() &&
- keyevents.first().msec == fe.msec) {
- KeyEvent ke = keyevents.takeFirst();
-
- ts << " Key {\n";
- ts << " type: " << ke.type << "\n";
- ts << " key: " << ke.key << "\n";
- ts << " modifiers: " << ke.modifiers << "\n";
- ts << " text: \"" << ke.text.toUtf8().toHex() << "\"\n";
- ts << " autorep: " << (ke.autorep?"true":"false") << "\n";
- ts << " count: " << ke.count << "\n";
- if (ke.destination == ViewPort)
- ts << " sendToViewport: true\n";
- ts << " }\n";
- }
- }
-
- ts << "}\n";
- file.close();
-}
-
-void QDeclarativeTester::updateCurrentTime(int msec)
-{
- QDeclarativeItemPrivate::setConsistentTime(msec);
-
- if (!testscript && msec > 16 && options & QDeclarativeViewer::Snapshot)
- return;
-
- QImage img(m_view->width(), m_view->height(), QImage::Format_RGB32);
-
- if (options & QDeclarativeViewer::TestImages) {
- img.fill(qRgb(255,255,255));
-
-/*#ifdef Q_OS_MAC //Compile failure on Cocoa x64 QTBUG-22304
- bool oldSmooth = qt_applefontsmoothing_enabled;
- qt_applefontsmoothing_enabled = false;
-#endif*/
- QPainter p(&img);
-/*#ifdef Q_OS_MAC //Compile failure on Cocoa x64 QTBUG-22304
- qt_applefontsmoothing_enabled = oldSmooth;
-#endif*/
-
- m_view->render(&p);
- }
-
- bool snapshot = msec == 16 && (options & QDeclarativeViewer::Snapshot
- || (testscript && testscript->count() == 2));
-
- FrameEvent fe;
- fe.msec = msec;
- if (msec == 0 || !(options & QDeclarativeViewer::TestImages)) {
- // Skip first frame, skip if not doing images
- } else if (0 == ((m_savedFrameEvents.count()-1) % 60) || snapshot) {
- fe.image = img;
- } else {
- QCryptographicHash hash(QCryptographicHash::Md5);
- hash.addData((const char *)img.bits(), img.bytesPerLine() * img.height());
- fe.hash = hash.result();
- }
- m_savedFrameEvents.append(fe);
-
- // Deliver mouse events
- filterEvents = false;
-
- if (!testscript) {
- for (int ii = 0; ii < m_mouseEvents.count(); ++ii) {
- MouseEvent &me = m_mouseEvents[ii];
- me.msec = msec;
- QMouseEvent event(me.type, me.pos, me.button, me.buttons, me.modifiers);
-
- if (me.destination == View) {
- QCoreApplication::sendEvent(m_view, &event);
- } else {
- QCoreApplication::sendEvent(m_view->viewport(), &event);
- }
- }
-
- for (int ii = 0; ii < m_keyEvents.count(); ++ii) {
- KeyEvent &ke = m_keyEvents[ii];
- ke.msec = msec;
- QKeyEvent event(ke.type, ke.key, ke.modifiers, ke.text, ke.autorep, ke.count);
-
- if (ke.destination == View) {
- QCoreApplication::sendEvent(m_view, &event);
- } else {
- QCoreApplication::sendEvent(m_view->viewport(), &event);
- }
- }
- m_savedMouseEvents.append(m_mouseEvents);
- m_savedKeyEvents.append(m_keyEvents);
- }
-
- m_mouseEvents.clear();
- m_keyEvents.clear();
-
- // Advance test script
- while (testscript && testscript->count() > testscriptidx) {
-
- QObject *event = testscript->event(testscriptidx);
-
- if (QDeclarativeVisualTestFrame *frame = qobject_cast<QDeclarativeVisualTestFrame *>(event)) {
- if (frame->msec() < msec) {
- if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) {
- qWarning() << "QDeclarativeTester(" << m_script << "): Extra frame. Seen:"
- << msec << "Expected:" << frame->msec();
- imagefailure();
- }
- } else if (frame->msec() == msec) {
- if (!frame->hash().isEmpty() && frame->hash().toUtf8() != fe.hash.toHex()) {
- if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) {
- qWarning() << "QDeclarativeTester(" << m_script << "): Mismatched frame hash at" << msec
- << ". Seen:" << fe.hash.toHex()
- << "Expected:" << frame->hash().toUtf8();
- imagefailure();
- }
- }
- } else if (frame->msec() > msec) {
- break;
- }
-
- if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record) && !frame->image().isEmpty()) {
- 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) {
- QString reject(frame->image().toLocalFile() + QLatin1String(".reject.png"));
- qWarning() << "QDeclarativeTester(" << m_script << "): Image mismatch. Reject saved to:"
- << reject;
- img.save(reject);
- bool doDiff = (goodImage.size() == img.size());
- if (doDiff) {
- QImage diffimg(m_view->width(), m_view->height(), QImage::Format_RGB32);
- diffimg.fill(qRgb(255,255,255));
- QPainter p(&diffimg);
- int diffCount = 0;
- for (int x = 0; x < img.width(); ++x) {
- for (int y = 0; y < img.height(); ++y) {
- if (goodImage.pixel(x,y) != img.pixel(x,y)) {
- ++diffCount;
- p.drawPoint(x,y);
- }
- }
- }
- QString diff(frame->image().toLocalFile() + QLatin1String(".diff.png"));
- diffimg.save(diff);
- qWarning().nospace() << " Diff (" << diffCount << " pixels differed) saved to: " << diff;
- }
- imagefailure();
- }
- }
- } else if (QDeclarativeVisualTestMouse *mouse = qobject_cast<QDeclarativeVisualTestMouse *>(event)) {
- QPoint pos(mouse->x(), mouse->y());
- QPoint globalPos = m_view->mapToGlobal(QPoint(0, 0)) + pos;
- QMouseEvent event((QEvent::Type)mouse->type(), pos, globalPos, (Qt::MouseButton)mouse->button(), (Qt::MouseButtons)mouse->buttons(), (Qt::KeyboardModifiers)mouse->modifiers());
-
- MouseEvent me(&event);
- me.msec = msec;
- if (!mouse->sendToViewport()) {
- QCoreApplication::sendEvent(m_view, &event);
- me.destination = View;
- } else {
- QCoreApplication::sendEvent(m_view->viewport(), &event);
- me.destination = ViewPort;
- }
- m_savedMouseEvents.append(me);
- } else if (QDeclarativeVisualTestKey *key = qobject_cast<QDeclarativeVisualTestKey *>(event)) {
-
- QKeyEvent event((QEvent::Type)key->type(), key->key(), (Qt::KeyboardModifiers)key->modifiers(), QString::fromUtf8(QByteArray::fromHex(key->text().toUtf8())), key->autorep(), key->count());
-
- KeyEvent ke(&event);
- ke.msec = msec;
- if (!key->sendToViewport()) {
- QCoreApplication::sendEvent(m_view, &event);
- ke.destination = View;
- } else {
- QCoreApplication::sendEvent(m_view->viewport(), &event);
- ke.destination = ViewPort;
- }
- m_savedKeyEvents.append(ke);
- }
- testscriptidx++;
- }
-
- filterEvents = true;
-
- if (testscript && testscript->count() <= testscriptidx) {
- //if (msec == 16) //for a snapshot, leave it up long enough to see
- // (void)::sleep(1);
- complete();
- }
-}
-
-void QDeclarativeTester::registerTypes()
-{
- qmlRegisterType<QDeclarativeVisualTest>("Qt.VisualTest", 4,7, "VisualTest");
- qmlRegisterType<QDeclarativeVisualTestFrame>("Qt.VisualTest", 4,7, "Frame");
- qmlRegisterType<QDeclarativeVisualTestMouse>("Qt.VisualTest", 4,7, "Mouse");
- qmlRegisterType<QDeclarativeVisualTestKey>("Qt.VisualTest", 4,7, "Key");
-}
-
-QT_END_NAMESPACE
diff --git a/tools/qmlviewer/qdeclarativetester.h b/tools/qmlviewer/qdeclarativetester.h
deleted file mode 100644
index 7cf0a3e0c8..0000000000
--- a/tools/qmlviewer/qdeclarativetester.h
+++ /dev/null
@@ -1,290 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVETESTER_H
-#define QDECLARATIVETESTER_H
-
-#include <QEvent>
-#include <QMouseEvent>
-#include <QKeyEvent>
-#include <QImage>
-#include <QUrl>
-#include <qmlruntime.h>
-#include <qdeclarativelist.h>
-#include <qdeclarative.h>
-#include <QAbstractAnimation>
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeVisualTest : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QDeclarativeListProperty<QObject> events READ events CONSTANT)
- Q_CLASSINFO("DefaultProperty", "events")
-public:
- QDeclarativeVisualTest() {}
-
- QDeclarativeListProperty<QObject> events() { return QDeclarativeListProperty<QObject>(this, m_events); }
-
- int count() const { return m_events.count(); }
- QObject *event(int idx) { return m_events.at(idx); }
-
-private:
- QList<QObject *> m_events;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QDeclarativeVisualTest)
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeVisualTestFrame : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int msec READ msec WRITE setMsec)
- Q_PROPERTY(QString hash READ hash WRITE setHash)
- Q_PROPERTY(QUrl image READ image WRITE setImage)
-public:
- QDeclarativeVisualTestFrame() : m_msec(-1) {}
-
- int msec() const { return m_msec; }
- void setMsec(int m) { m_msec = m; }
-
- QString hash() const { return m_hash; }
- void setHash(const QString &hash) { m_hash = hash; }
-
- QUrl image() const { return m_image; }
- void setImage(const QUrl &image) { m_image = image; }
-
-private:
- int m_msec;
- QString m_hash;
- QUrl m_image;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QDeclarativeVisualTestFrame)
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeVisualTestMouse : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int type READ type WRITE setType)
- Q_PROPERTY(int button READ button WRITE setButton)
- Q_PROPERTY(int buttons READ buttons WRITE setButtons)
- Q_PROPERTY(int x READ x WRITE setX)
- Q_PROPERTY(int y READ y WRITE setY)
- Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers)
- Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport)
-public:
- QDeclarativeVisualTestMouse() : m_type(0), m_button(0), m_buttons(0), m_x(0), m_y(0), m_modifiers(0), m_viewport(false) {}
-
- int type() const { return m_type; }
- void setType(int t) { m_type = t; }
-
- int button() const { return m_button; }
- void setButton(int b) { m_button = b; }
-
- int buttons() const { return m_buttons; }
- void setButtons(int b) { m_buttons = b; }
-
- int x() const { return m_x; }
- void setX(int x) { m_x = x; }
-
- int y() const { return m_y; }
- void setY(int y) { m_y = y; }
-
- int modifiers() const { return m_modifiers; }
- void setModifiers(int modifiers) { m_modifiers = modifiers; }
-
- bool sendToViewport() const { return m_viewport; }
- void setSendToViewport(bool v) { m_viewport = v; }
-private:
- int m_type;
- int m_button;
- int m_buttons;
- int m_x;
- int m_y;
- int m_modifiers;
- bool m_viewport;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QDeclarativeVisualTestMouse)
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeVisualTestKey : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int type READ type WRITE setType)
- Q_PROPERTY(int key READ key WRITE setKey)
- Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers)
- Q_PROPERTY(QString text READ text WRITE setText)
- Q_PROPERTY(bool autorep READ autorep WRITE setAutorep)
- Q_PROPERTY(int count READ count WRITE setCount)
- Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport)
-public:
- QDeclarativeVisualTestKey() : m_type(0), m_key(0), m_modifiers(0), m_autorep(false), m_count(0), m_viewport(false) {}
-
- int type() const { return m_type; }
- void setType(int t) { m_type = t; }
-
- int key() const { return m_key; }
- void setKey(int k) { m_key = k; }
-
- int modifiers() const { return m_modifiers; }
- void setModifiers(int m) { m_modifiers = m; }
-
- QString text() const { return m_text; }
- void setText(const QString &t) { m_text = t; }
-
- bool autorep() const { return m_autorep; }
- void setAutorep(bool a) { m_autorep = a; }
-
- int count() const { return m_count; }
- void setCount(int c) { m_count = c; }
-
- bool sendToViewport() const { return m_viewport; }
- void setSendToViewport(bool v) { m_viewport = v; }
-private:
- int m_type;
- int m_key;
- int m_modifiers;
- QString m_text;
- bool m_autorep;
- int m_count;
- bool m_viewport;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QDeclarativeVisualTestKey)
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeTester : public QAbstractAnimation
-{
-public:
- QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions options, QDeclarativeView *parent);
- ~QDeclarativeTester();
-
- static void registerTypes();
-
- virtual int duration() const;
-
- void run();
- void save();
-
- void executefailure();
-protected:
- virtual void updateCurrentTime(int msecs);
- virtual bool eventFilter(QObject *, QEvent *);
-
-private:
- QString m_script;
-
- void imagefailure();
- void complete();
- void testSkip();
-
- enum Destination { View, ViewPort };
- void addKeyEvent(Destination, QKeyEvent *);
- void addMouseEvent(Destination, QMouseEvent *);
- QDeclarativeView *m_view;
-
- struct MouseEvent {
- MouseEvent(QMouseEvent *e)
- : type(e->type()), button(e->button()), buttons(e->buttons()),
- pos(e->pos()), modifiers(e->modifiers()), destination(View) {}
-
- QEvent::Type type;
- Qt::MouseButton button;
- Qt::MouseButtons buttons;
- QPoint pos;
- Qt::KeyboardModifiers modifiers;
- Destination destination;
-
- int msec;
- };
- struct KeyEvent {
- KeyEvent(QKeyEvent *e)
- : type(e->type()), key(e->key()), modifiers(e->modifiers()), text(e->text()),
- autorep(e->isAutoRepeat()), count(e->count()), destination(View) {}
- QEvent::Type type;
- int key;
- Qt::KeyboardModifiers modifiers;
- QString text;
- bool autorep;
- ushort count;
- Destination destination;
-
- int msec;
- };
- struct FrameEvent {
- QImage image;
- QByteArray hash;
- int msec;
- };
- QList<MouseEvent> m_mouseEvents;
- QList<KeyEvent> m_keyEvents;
-
- QList<MouseEvent> m_savedMouseEvents;
- QList<KeyEvent> m_savedKeyEvents;
- QList<FrameEvent> m_savedFrameEvents;
- bool filterEvents;
-
- QDeclarativeViewer::ScriptOptions options;
- int testscriptidx;
- QDeclarativeVisualTest *testscript;
-
- bool hasCompleted;
- bool hasFailed;
-};
-
-
-QT_END_NAMESPACE
-
-#endif // QDECLARATIVETESTER_H
diff --git a/tools/qmlviewer/qml.icns b/tools/qmlviewer/qml.icns
deleted file mode 100644
index c76051626a..0000000000
--- a/tools/qmlviewer/qml.icns
+++ /dev/null
Binary files differ
diff --git a/tools/qmlviewer/qml.pri b/tools/qmlviewer/qml.pri
deleted file mode 100644
index 8f54505f0e..0000000000
--- a/tools/qmlviewer/qml.pri
+++ /dev/null
@@ -1,32 +0,0 @@
-QT += core-private gui-private v8-private declarative-private network sql
-contains(QT_CONFIG, opengl) {
- QT += opengl
- DEFINES += GL_SUPPORTED
-}
-
-INCLUDEPATH += $$PWD
-
-HEADERS += $$PWD/qmlruntime.h \
- $$PWD/proxysettings.h \
- $$PWD/qdeclarativetester.h \
- $$PWD/deviceorientation.h \
- $$PWD/loggerwidget.h
-SOURCES += $$PWD/qmlruntime.cpp \
- $$PWD/proxysettings.cpp \
- $$PWD/qdeclarativetester.cpp \
- $$PWD/loggerwidget.cpp
-
-RESOURCES = $$PWD/browser/browser.qrc \
- $$PWD/startup/startup.qrc
-
-linux-g++-maemo {
- QT += dbus
- SOURCES += $$PWD/deviceorientation_harmattan.cpp
- FORMS = $$PWD/recopts.ui \
- $$PWD/proxysettings.ui
-} else {
- SOURCES += $$PWD/deviceorientation.cpp
- FORMS = $$PWD/recopts.ui \
- $$PWD/proxysettings.ui
-}
-
diff --git a/tools/qmlviewer/qmlruntime.cpp b/tools/qmlviewer/qmlruntime.cpp
deleted file mode 100644
index 76b1328d6d..0000000000
--- a/tools/qmlviewer/qmlruntime.cpp
+++ /dev/null
@@ -1,1351 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtQuick1/qdeclarativeview.h>
-
-#ifdef hz
-#undef hz
-#endif
-# include "ui_recopts.h"
-
-#include "qmlruntime.h"
-#include <qdeclarativecontext.h>
-#include <qdeclarativeengine.h>
-#include <qdeclarativenetworkaccessmanagerfactory.h>
-#include "qdeclarative.h"
-#include <QAbstractAnimation>
-#include <private/qabstractanimation_p.h>
-
-#include <QSettings>
-#include <QMimeData>
-#include <QXmlStreamReader>
-#include <QBuffer>
-#include <QNetworkReply>
-#include <QNetworkCookie>
-#include <QNetworkCookieJar>
-#include <QNetworkDiskCache>
-#include <QNetworkAccessManager>
-#include <QSignalMapper>
-#include <QDeclarativeComponent>
-#include <QWidget>
-#include <QApplication>
-#include <QTranslator>
-#include <QDir>
-#include <QTextBrowser>
-#include <QFile>
-#include <QFileInfo>
-#include <QVBoxLayout>
-#include <QProgressDialog>
-#include <QProcess>
-#include <QMenuBar>
-#include <QMenu>
-#include <QAction>
-#include <QFileDialog>
-#include <QInputDialog>
-#include <QTimer>
-#include <QGraphicsObject>
-#include <QNetworkProxyFactory>
-#include <QKeyEvent>
-#include <QMimeData>
-#include <QMutex>
-#include <QMutexLocker>
-#include "proxysettings.h"
-#include "deviceorientation.h"
-#include <qdeclarativetester.h>
-
-#ifdef GL_SUPPORTED
-#include <QGLWidget>
-#endif
-
-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
-{
- Q_OBJECT
-
- Q_PROPERTY(bool isActiveWindow READ isActiveWindow NOTIFY isActiveWindowChanged)
- Q_PROPERTY(DeviceOrientation::Orientation orientation READ orientation NOTIFY orientationChanged)
-
-public:
- static Runtime* instance()
- {
- static Runtime *instance = 0;
- if (!instance)
- instance = new Runtime;
- return instance;
- }
-
- bool isActiveWindow() const { return activeWindow; }
- void setActiveWindow(bool active)
- {
- if (active == activeWindow)
- return;
- activeWindow = active;
- emit isActiveWindowChanged();
- }
-
- DeviceOrientation::Orientation orientation() const { return DeviceOrientation::instance()->orientation(); }
-
-Q_SIGNALS:
- void isActiveWindowChanged();
- void orientationChanged();
-
-private:
- Runtime(QObject *parent=0) : QObject(parent), activeWindow(false)
- {
- connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()),
- this, SIGNAL(orientationChanged()));
- }
-
- bool activeWindow;
-};
-
-static struct { const char *name, *args; } ffmpegprofiles[] = {
- {"Maximum Quality", "-sameq"},
- {"High Quality", "-qmax 2"},
- {"Medium Quality", "-qmax 6"},
- {"Low Quality", "-qmax 16"},
- {"Custom ffmpeg arguments", ""},
- {0,0}
-};
-
-class RecordingDialog : public QDialog, public Ui::RecordingOptions {
- Q_OBJECT
-
-public:
- RecordingDialog(QWidget *parent) : QDialog(parent)
- {
- setupUi(this);
- hz->setValidator(new QDoubleValidator(hz));
- for (int i=0; ffmpegprofiles[i].name; ++i) {
- profile->addItem(QString::fromAscii(ffmpegprofiles[i].name));
- }
- }
-
- void setArguments(QString a)
- {
- int i;
- for (i=0; ffmpegprofiles[i].args[0]; ++i) {
- if (QString::fromAscii(ffmpegprofiles[i].args) == a) {
- profile->setCurrentIndex(i);
- args->setText(QString::fromAscii(ffmpegprofiles[i].args));
- return;
- }
- }
- customargs = a;
- args->setText(a);
- profile->setCurrentIndex(i);
- }
-
- QString arguments() const
- {
- int i = profile->currentIndex();
- return ffmpegprofiles[i].args[0] ? QLatin1String(ffmpegprofiles[i].args) : customargs;
- }
-
- void setOriginalSize(const QSize &s)
- {
- QString str = tr("Original (%1x%2)").arg(s.width()).arg(s.height());
-
- sizeOriginal->setText(str);
- if (sizeWidth->value()<=1) {
- sizeWidth->setValue(s.width());
- sizeHeight->setValue(s.height());
- }
- }
-
- void showffmpegOptions(bool b)
- {
- ffmpegOptions->setVisible(b);
- }
-
- void showRateOptions(bool b)
- {
- rateOptions->setVisible(b);
- }
-
- void setVideoRate(int rate)
- {
- if (rate == 24)
- hz24->setChecked(true);
- else if (rate == 25)
- hz25->setChecked(true);
- else if (rate == 50)
- hz50->setChecked(true);
- else if (rate == 60)
- hz60->setChecked(true);
- else {
- hzCustom->setChecked(true);
- hz->setText(QString::number(rate));
- }
- }
-
- int videoRate() const
- {
- if (hz24->isChecked())
- return 24;
- else if (hz25->isChecked())
- return 25;
- else if (hz50->isChecked())
- return 50;
- else if (hz60->isChecked())
- return 60;
- else {
- return hz->text().toInt();
- }
- }
-
- QSize videoSize() const
- {
- if (sizeOriginal->isChecked())
- return QSize();
- else if (size720p->isChecked())
- return QSize(1280,720);
- else if (sizeVGA->isChecked())
- return QSize(640,480);
- else if (sizeQVGA->isChecked())
- return QSize(320,240);
- else
- return QSize(sizeWidth->value(), sizeHeight->value());
- }
-
-
-
-private slots:
- void pickProfile(int i)
- {
- if (ffmpegprofiles[i].args[0]) {
- args->setText(QLatin1String(ffmpegprofiles[i].args));
- } else {
- args->setText(customargs);
- }
- }
-
- void storeCustomArgs(QString s)
- {
- setArguments(s);
- }
-
-private:
- QString customargs;
-};
-
-class PersistentCookieJar : public QNetworkCookieJar {
-public:
- PersistentCookieJar(QObject *parent) : QNetworkCookieJar(parent) { load(); }
- ~PersistentCookieJar() { save(); }
-
- virtual QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const
- {
- QMutexLocker lock(&mutex);
- return QNetworkCookieJar::cookiesForUrl(url);
- }
-
- virtual bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url)
- {
- QMutexLocker lock(&mutex);
- return QNetworkCookieJar::setCookiesFromUrl(cookieList, url);
- }
-
-private:
- void save()
- {
- QMutexLocker lock(&mutex);
- QList<QNetworkCookie> list = allCookies();
- QByteArray data;
- foreach (QNetworkCookie cookie, list) {
- if (!cookie.isSessionCookie()) {
- data.append(cookie.toRawForm());
- data.append("\n");
- }
- }
- QSettings settings;
- settings.setValue(QLatin1String("Cookies"), data);
- }
-
- void load()
- {
- QMutexLocker lock(&mutex);
- QSettings settings;
- QByteArray data = settings.value(QLatin1String("Cookies")).toByteArray();
- setAllCookies(QNetworkCookie::parseCookies(data));
- }
-
- mutable QMutex mutex;
-};
-
-class SystemProxyFactory : public QNetworkProxyFactory
-{
-public:
- SystemProxyFactory() : proxyDirty(true), httpProxyInUse(false) {
- }
-
- virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query)
- {
- if (proxyDirty)
- setupProxy();
- QString protocolTag = query.protocolTag();
- if (httpProxyInUse && (protocolTag == QLatin1String("http") || protocolTag == QLatin1String("https"))) {
- QList<QNetworkProxy> ret;
- ret << httpProxy;
- return ret;
- }
-#ifdef Q_OS_WIN
- // systemProxyForQuery can take insanely long on Windows (QTBUG-10106)
- return QNetworkProxyFactory::proxyForQuery(query);
-#else
- return QNetworkProxyFactory::systemProxyForQuery(query);
-#endif
- }
-
- void setupProxy() {
- // Don't bother locking because we know that the proxy only
- // changes in response to the settings dialog and that
- // the view will be reloaded.
- proxyDirty = false;
- httpProxyInUse = ProxySettings::httpProxyInUse();
- if (httpProxyInUse)
- httpProxy = ProxySettings::httpProxy();
- }
-
- void proxyChanged() {
- proxyDirty = true;
- }
-
-private:
- volatile bool proxyDirty;
- bool httpProxyInUse;
- QNetworkProxy httpProxy;
-};
-
-class NetworkAccessManagerFactory : public QObject, public QDeclarativeNetworkAccessManagerFactory
-{
- Q_OBJECT
-public:
- NetworkAccessManagerFactory() : cacheSize(0) {}
- ~NetworkAccessManagerFactory() {}
-
- QNetworkAccessManager *create(QObject *parent);
-
- void setCacheSize(int size) {
- if (size != cacheSize) {
- cacheSize = size;
- }
- }
-
- void proxyChanged() {
- foreach (QNetworkAccessManager *nam, namList) {
- static_cast<SystemProxyFactory*>(nam->proxyFactory())->proxyChanged();
- }
- }
-
- static PersistentCookieJar *cookieJar;
-
-private slots:
- void managerDestroyed(QObject *obj) {
- namList.removeOne(static_cast<QNetworkAccessManager*>(obj));
- }
-
-private:
- QMutex mutex;
- int cacheSize;
- QList<QNetworkAccessManager*> namList;
-};
-
-PersistentCookieJar *NetworkAccessManagerFactory::cookieJar = 0;
-
-static void cleanup_cookieJar()
-{
- delete NetworkAccessManagerFactory::cookieJar;
- NetworkAccessManagerFactory::cookieJar = 0;
-}
-
-QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent)
-{
- QMutexLocker lock(&mutex);
- QNetworkAccessManager *manager = new QNetworkAccessManager(parent);
- if (!cookieJar) {
- qAddPostRoutine(cleanup_cookieJar);
- cookieJar = new PersistentCookieJar(0);
- }
- manager->setCookieJar(cookieJar);
- cookieJar->setParent(0);
- manager->setProxyFactory(new SystemProxyFactory);
- if (cacheSize > 0) {
- QNetworkDiskCache *cache = new QNetworkDiskCache;
- cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-viewer-network-cache"));
- cache->setMaximumCacheSize(cacheSize);
- manager->setCache(cache);
- } else {
- manager->setCache(0);
- }
- connect(manager, SIGNAL(destroyed(QObject*)), this, SLOT(managerDestroyed(QObject*)));
- namList.append(manager);
- return manager;
-}
-
-QString QDeclarativeViewer::getVideoFileName()
-{
- QString title = convertAvailable || ffmpegAvailable ? tr("Save Video File") : tr("Save PNG Frames");
- QStringList types;
- if (ffmpegAvailable) types += tr("Common Video files")+QLatin1String(" (*.avi *.mpeg *.mov)");
- if (convertAvailable) types += tr("GIF Animation")+QLatin1String(" (*.gif)");
- types += tr("Individual PNG frames")+QLatin1String(" (*.png)");
- if (ffmpegAvailable) types += tr("All ffmpeg formats (*.*)");
- return QFileDialog::getSaveFileName(this, title, QString(), types.join(QLatin1String(";; ")));
-}
-
-QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
- : QMainWindow(parent, flags)
- , loggerWindow(new LoggerWidget(this))
- , frame_stream(0)
- , rotateAction(0)
- , orientation(0)
- , showWarningsWindow(0)
- , m_scriptOptions(0)
- , tester(0)
- , useQmlFileBrowser(true)
- , translator(0)
-{
- QDeclarativeViewer::registerTypes();
- setWindowTitle(tr("Qt QML Viewer"));
- devicemode = false;
- canvas = 0;
- record_autotime = 0;
- record_rate = 50;
- record_args += QLatin1String("-sameq");
-
- recdlg = new RecordingDialog(this);
- connect(recdlg->pickfile, SIGNAL(clicked()), this, SLOT(pickRecordingFile()));
- senseFfmpeg();
- senseImageMagick();
- if (!ffmpegAvailable)
- recdlg->showffmpegOptions(false);
- if (!ffmpegAvailable && !convertAvailable)
- recdlg->showRateOptions(false);
- QString warn;
- if (!ffmpegAvailable) {
- if (!convertAvailable)
- warn = tr("ffmpeg and ImageMagick not available - no video output");
- else
- warn = tr("ffmpeg not available - GIF and PNG outputs only");
- recdlg->warning->setText(warn);
- } else {
- recdlg->warning->hide();
- }
-
- canvas = new DragAndDropView(this);
-
- canvas->setAttribute(Qt::WA_OpaquePaintEvent);
- canvas->setAttribute(Qt::WA_NoSystemBackground);
-
- canvas->setFocus();
-
- QObject::connect(canvas, SIGNAL(initialSizeChanged(QSize)), this, SLOT(initialSizeChanged(QSize)));
- QObject::connect(canvas, SIGNAL(statusChanged(QDeclarativeView::Status)), this, SLOT(statusChanged()));
- QObject::connect(canvas->engine(), SIGNAL(quit()), this, SLOT(close()));
-
- QObject::connect(warningsWidget(), SIGNAL(opened()), this, SLOT(warningsWidgetOpened()));
- QObject::connect(warningsWidget(), SIGNAL(closed()), this, SLOT(warningsWidgetClosed()));
-
- if (!(flags & Qt::FramelessWindowHint)) {
- createMenu();
- changeOrientation(orientation->actions().value(0));
- } else {
- setMenuBar(0);
- }
-
- setCentralWidget(canvas);
-
- namFactory = new NetworkAccessManagerFactory;
- canvas->engine()->setNetworkAccessManagerFactory(namFactory);
-
- connect(&autoStartTimer, SIGNAL(timeout()), this, SLOT(autoStartRecording()));
- connect(&autoStopTimer, SIGNAL(timeout()), this, SLOT(autoStopRecording()));
- connect(&recordTimer, SIGNAL(timeout()), this, SLOT(recordFrame()));
- connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()),
- this, SLOT(orientationChanged()), Qt::QueuedConnection);
- autoStartTimer.setSingleShot(true);
- autoStopTimer.setSingleShot(true);
- recordTimer.setSingleShot(false);
-
- QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(appAboutToQuit()));
-}
-
-QDeclarativeViewer::~QDeclarativeViewer()
-{
- delete loggerWindow;
- canvas->engine()->setNetworkAccessManagerFactory(0);
- delete namFactory;
-}
-
-void QDeclarativeViewer::enableExperimentalGestures()
-{
-#ifndef QT_NO_GESTURES
- 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::PanGesture,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()->setAttribute(Qt::WA_AcceptTouchEvents);
-#endif
-}
-
-QDeclarativeView *QDeclarativeViewer::view() const
-{
- return canvas;
-}
-
-LoggerWidget *QDeclarativeViewer::warningsWidget() const
-{
- return loggerWindow;
-}
-
-void QDeclarativeViewer::createMenu()
-{
- QAction *openAction = new QAction(tr("&Open..."), this);
- openAction->setShortcuts(QKeySequence::Open);
- 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);
- reloadAction->setShortcuts(QKeySequence::Refresh);
- connect(reloadAction, SIGNAL(triggered()), this, SLOT(reload()));
-
- QAction *snapshotAction = new QAction(tr("&Take Snapshot"), this);
- snapshotAction->setShortcut(QKeySequence(tr("F3")));
- connect(snapshotAction, SIGNAL(triggered()), this, SLOT(takeSnapShot()));
-
- recordAction = new QAction(tr("Start Recording &Video"), this);
- recordAction->setShortcut(QKeySequence(tr("F9")));
- connect(recordAction, SIGNAL(triggered()), this, SLOT(toggleRecordingWithSelection()));
-
- QAction *recordOptions = new QAction(tr("Video &Options..."), this);
- connect(recordOptions, SIGNAL(triggered()), this, SLOT(chooseRecordingOptions()));
-
- QAction *slowAction = new QAction(tr("&Slow Down Animations"), this);
- slowAction->setShortcut(QKeySequence(tr("Ctrl+.")));
- slowAction->setCheckable(true);
- connect(slowAction, SIGNAL(triggered(bool)), this, SLOT(setSlowMode(bool)));
-
- showWarningsWindow = new QAction(tr("Show Warnings"), this);
- showWarningsWindow->setCheckable((true));
- showWarningsWindow->setChecked(loggerWindow->isVisible());
- connect(showWarningsWindow, SIGNAL(triggered(bool)), this, SLOT(showWarnings(bool)));
-
- QAction *proxyAction = new QAction(tr("HTTP &Proxy..."), this);
- connect(proxyAction, SIGNAL(triggered()), this, SLOT(showProxySettings()));
-
- QAction *fullscreenAction = new QAction(tr("Full Screen"), this);
- fullscreenAction->setCheckable(true);
- connect(fullscreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
-
- rotateAction = new QAction(tr("Rotate orientation"), this);
- rotateAction->setShortcut(QKeySequence(tr("Ctrl+T")));
- connect(rotateAction, SIGNAL(triggered()), this, SLOT(rotateOrientation()));
-
- orientation = new QActionGroup(this);
- orientation->setExclusive(true);
- connect(orientation, SIGNAL(triggered(QAction*)), this, SLOT(changeOrientation(QAction*)));
-
- QAction *portraitAction = new QAction(tr("Portrait"), this);
- portraitAction->setCheckable(true);
- QAction *landscapeAction = new QAction(tr("Landscape"), this);
- landscapeAction->setCheckable(true);
- QAction *portraitInvAction = new QAction(tr("Portrait (inverted)"), this);
- portraitInvAction->setCheckable(true);
- QAction *landscapeInvAction = new QAction(tr("Landscape (inverted)"), this);
- landscapeInvAction->setCheckable(true);
-
- QAction *aboutAction = new QAction(tr("&About Qt..."), this);
- aboutAction->setMenuRole(QAction::AboutQtRole);
- 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);
- quitAction->setMenuRole(QAction::QuitRole);
- quitAction->setShortcuts(QKeySequence::Quit);
- connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
-
- QMenuBar *menu = menuBar();
- if (!menu)
- return;
-
- QMenu *fileMenu = menu->addMenu(tr("&File"));
- fileMenu->addAction(openAction);
- fileMenu->addAction(openUrlAction);
- fileMenu->addAction(reloadAction);
- fileMenu->addSeparator();
- fileMenu->addAction(closeAction);
- fileMenu->addAction(quitAction);
-
- QMenu *recordMenu = menu->addMenu(tr("&Recording"));
- recordMenu->addAction(snapshotAction);
- recordMenu->addAction(recordAction);
-
- QMenu *debugMenu = menu->addMenu(tr("&Debugging"));
- debugMenu->addAction(slowAction);
- debugMenu->addAction(showWarningsWindow);
-
- QMenu *settingsMenu = menu->addMenu(tr("&Settings"));
- settingsMenu->addAction(proxyAction);
- settingsMenu->addAction(recordOptions);
- settingsMenu->addMenu(loggerWindow->preferencesMenu());
- settingsMenu->addAction(rotateAction);
-
- QMenu *propertiesMenu = settingsMenu->addMenu(tr("Properties"));
-
- orientation->addAction(portraitAction);
- orientation->addAction(landscapeAction);
- orientation->addAction(portraitInvAction);
- orientation->addAction(landscapeInvAction);
- propertiesMenu->addActions(orientation->actions());
-
- QMenu *helpMenu = menu->addMenu(tr("&Help"));
- helpMenu->addAction(aboutAction);
-}
-
-void QDeclarativeViewer::showProxySettings()
-{
- ProxySettings settingsDlg (this);
-
- connect (&settingsDlg, SIGNAL (accepted()), this, SLOT (proxySettingsChanged ()));
-
- settingsDlg.exec();
-}
-
-void QDeclarativeViewer::proxySettingsChanged()
-{
- namFactory->proxyChanged();
- reload ();
-}
-
-void QDeclarativeViewer::rotateOrientation()
-{
- QAction *current = orientation->checkedAction();
- QList<QAction *> actions = orientation->actions();
- int index = actions.indexOf(current);
- if (index < 0)
- return;
-
- QAction *newOrientation = actions[(index + 1) % actions.count()];
- changeOrientation(newOrientation);
-}
-
-void QDeclarativeViewer::toggleFullScreen()
-{
- if (isFullScreen())
- showMaximized();
- else
- showFullScreen();
-}
-
-void QDeclarativeViewer::showWarnings(bool show)
-{
- loggerWindow->setVisible(show);
-}
-
-void QDeclarativeViewer::warningsWidgetOpened()
-{
- showWarningsWindow->setChecked(true);
-}
-
-void QDeclarativeViewer::warningsWidgetClosed()
-{
- showWarningsWindow->setChecked(false);
-}
-
-void QDeclarativeViewer::takeSnapShot()
-{
- static int snapshotcount = 1;
- QString snapFileName = QString(QLatin1String("snapshot%1.png")).arg(snapshotcount);
- QPixmap::grabWidget(canvas).save(snapFileName);
- qDebug() << "Wrote" << snapFileName;
- ++snapshotcount;
-}
-
-void QDeclarativeViewer::pickRecordingFile()
-{
- QString fileName = getVideoFileName();
- if (!fileName.isEmpty())
- recdlg->file->setText(fileName);
-}
-
-void QDeclarativeViewer::chooseRecordingOptions()
-{
- // File
- recdlg->file->setText(record_file);
-
- // Size
- recdlg->setOriginalSize(canvas->size());
-
- // Rate
- recdlg->setVideoRate(record_rate);
-
-
- // Profile
- recdlg->setArguments(record_args.join(QLatin1String(" ")));
- if (recdlg->exec()) {
- // File
- record_file = recdlg->file->text();
- // Size
- record_outsize = recdlg->videoSize();
- // Rate
- record_rate = recdlg->videoRate();
- // Profile
- record_args = recdlg->arguments().split(QLatin1Char(' '),QString::SkipEmptyParts);
- }
-}
-
-void QDeclarativeViewer::toggleRecordingWithSelection()
-{
- if (!recordTimer.isActive()) {
- if (record_file.isEmpty()) {
- QString fileName = getVideoFileName();
- if (fileName.isEmpty())
- return;
- if (!fileName.contains(QRegExp(QLatin1String(".[^\\/]*$"))))
- fileName += QLatin1String(".avi");
- setRecordFile(fileName);
- }
- }
- toggleRecording();
-}
-
-void QDeclarativeViewer::toggleRecording()
-{
- if (record_file.isEmpty()) {
- toggleRecordingWithSelection();
- return;
- }
- bool recording = !recordTimer.isActive();
- recordAction->setText(recording ? tr("&Stop Recording Video\tF9") : tr("&Start Recording Video\tF9"));
- setRecording(recording);
-}
-
-void QDeclarativeViewer::setSlowMode(bool enable)
-{
- QUnifiedTimer::instance()->setSlowModeEnabled(enable);
-}
-
-void QDeclarativeViewer::addLibraryPath(const QString& lib)
-{
- canvas->engine()->addImportPath(lib);
-}
-
-void QDeclarativeViewer::addPluginPath(const QString& plugin)
-{
- canvas->engine()->addPluginPath(plugin);
-}
-
-void QDeclarativeViewer::reload()
-{
- launch(currentFileOrUrl);
-}
-
-void QDeclarativeViewer::openFile()
-{
- QString cur = canvas->source().toLocalFile();
- if (useQmlFileBrowser) {
- open(QLatin1String("qrc:/browser/Browser.qml"));
- } else {
- QString fileName = QFileDialog::getOpenFileName(this, tr("Open QML file"), cur, tr("QML Files (*.qml)"));
- if (!fileName.isEmpty()) {
- QFileInfo fi(fileName);
- open(fi.absoluteFilePath());
- }
- }
-}
-
-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()
-{
- if (canvas->status() == QDeclarativeView::Error && tester)
- tester->executefailure();
-
- if (canvas->status() == QDeclarativeView::Ready) {
- initialSize = canvas->initialSize();
- updateSizeHints(true);
- QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize)));
- }
-}
-
-void QDeclarativeViewer::launch(const QString& file_or_url)
-{
- QMetaObject::invokeMethod(this, "open", Qt::QueuedConnection, Q_ARG(QString, file_or_url));
-}
-
-void QDeclarativeViewer::loadTranslationFile(const QString& directory)
-{
- if (!translator) {
- translator = new QTranslator(this);
- QApplication::installTranslator(translator);
- }
-
- translator->load(QLatin1String("qml_" )+QLocale::system().name(), directory + QLatin1String("/i18n"));
-}
-
-void QDeclarativeViewer::loadDummyDataFiles(const QString& directory)
-{
- QDir dir(directory + QLatin1String("/dummydata"), QLatin1String("*.qml"));
- QStringList list = dir.entryList();
- for (int i = 0; i < list.size(); ++i) {
- QString qml = list.at(i);
- QDeclarativeComponent comp(canvas->engine(), dir.filePath(qml));
- QObject *dummyData = comp.create();
-
- if(comp.isError()) {
- QList<QDeclarativeError> errors = comp.errors();
- foreach (const QDeclarativeError &error, errors) {
- qWarning() << error;
- }
- if (tester) tester->executefailure();
- }
-
- if (dummyData) {
- qWarning() << "Loaded dummy data:" << dir.filePath(qml);
- qml.truncate(qml.length()-4);
- canvas->rootContext()->setContextProperty(qml, dummyData);
- dummyData->setParent(this);
- }
- }
-}
-
-bool QDeclarativeViewer::open(const QString& file_or_url)
-{
- currentFileOrUrl = file_or_url;
-
- QUrl url;
- QFileInfo fi(file_or_url);
- if (fi.exists())
- url = QUrl::fromLocalFile(fi.absoluteFilePath());
- else
- url = QUrl(file_or_url);
- setWindowTitle(tr("%1 - Qt QML Viewer").arg(file_or_url));
-
- if (!m_script.isEmpty())
- tester = new QDeclarativeTester(m_script, m_scriptOptions, canvas);
-
- delete canvas->rootObject();
- canvas->engine()->clearComponentCache();
- QDeclarativeContext *ctxt = canvas->rootContext();
- ctxt->setContextProperty(QLatin1String("qmlViewer"), this);
- ctxt->setContextProperty(QLatin1String("qmlViewerFolder"), QDir::currentPath());
- ctxt->setContextProperty(QLatin1String("runtime"), Runtime::instance());
-
- QString fileName = url.toLocalFile();
- if (!fileName.isEmpty()) {
- fi.setFile(fileName);
- if (fi.exists()) {
- if (fi.suffix().toLower() != QLatin1String("qml")) {
- qWarning() << "qml cannot open non-QML file" << fileName;
- return false;
- }
-
- QFileInfo fi(fileName);
- loadTranslationFile(fi.path());
- loadDummyDataFiles(fi.path());
- } else {
- qWarning() << "qml cannot find file:" << fileName;
- return false;
- }
- }
-
- QTime t;
- t.start();
-
- QObject::disconnect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize)));
- canvas->setSource(url);
-
- return true;
-}
-
-void QDeclarativeViewer::setAutoRecord(int from, int to)
-{
- if (from==0) from=1; // ensure resized
- record_autotime = to-from;
- autoStartTimer.setInterval(from);
- autoStartTimer.start();
-}
-
-void QDeclarativeViewer::setRecordArgs(const QStringList& a)
-{
- record_args = a;
-}
-
-void QDeclarativeViewer::setRecordFile(const QString& f)
-{
- record_file = f;
-}
-
-void QDeclarativeViewer::setRecordRate(int fps)
-{
- record_rate = fps;
-}
-
-void QDeclarativeViewer::sceneResized(QSize)
-{
- updateSizeHints();
-}
-
-void QDeclarativeViewer::initialSizeChanged(QSize size)
-{
- if (!isFullScreen() && !isMaximized()) {
- canvas->setGeometry(0,0,size.width(),size.height());
- layout()->setSizeConstraint(QLayout::SetFixedSize);
- layout()->activate();
- }
-}
-
-void QDeclarativeViewer::keyPressEvent(QKeyEvent *event)
-{
- if (event->key() == Qt::Key_0 && devicemode)
- exit(0);
- else if (event->key() == Qt::Key_F1 || (event->key() == Qt::Key_1 && devicemode)) {
- qDebug() << "F1 - help\n"
- << "F2 - save test script\n"
- << "F3 - take PNG snapshot\n"
- << "F4 - show items and state\n"
- << "F5 - reload QML\n"
- << "F6 - show object tree\n"
- << "F7 - show timing\n"
- << "F9 - toggle video recording\n"
- << "F10 - toggle orientation\n"
- << "device keys: 0=quit, 1..8=F1..F8"
- ;
- } else if (event->key() == Qt::Key_F2 || (event->key() == Qt::Key_2 && devicemode)) {
- if (tester && m_scriptOptions & Record)
- tester->save();
- } else if (event->key() == Qt::Key_F3 || (event->key() == Qt::Key_3 && devicemode)) {
- takeSnapShot();
- } else if (event->key() == Qt::Key_F5 || (event->key() == Qt::Key_5 && devicemode)) {
- reload();
- } else if (event->key() == Qt::Key_F9 || (event->key() == Qt::Key_9 && devicemode)) {
- toggleRecording();
- } else if (event->key() == Qt::Key_F10) {
- rotateOrientation();
- }
-
- QWidget::keyPressEvent(event);
-}
-
-bool QDeclarativeViewer::event(QEvent *event)
-{
- if (event->type() == QEvent::WindowActivate) {
- Runtime::instance()->setActiveWindow(true);
- DeviceOrientation::instance()->resumeListening();
- } else if (event->type() == QEvent::WindowDeactivate) {
- Runtime::instance()->setActiveWindow(false);
- DeviceOrientation::instance()->pauseListening();
- }
- return QWidget::event(event);
-}
-
-void QDeclarativeViewer::senseImageMagick()
-{
- QProcess proc;
- proc.start(QLatin1String("convert"), QStringList() << QLatin1String("-h"));
- proc.waitForFinished(2000);
- QString help = QString::fromAscii(proc.readAllStandardOutput());
- convertAvailable = help.contains(QLatin1String("ImageMagick"));
-}
-
-void QDeclarativeViewer::senseFfmpeg()
-{
- QProcess proc;
- proc.start(QLatin1String("ffmpeg"), QStringList() << QLatin1String("-h"));
- proc.waitForFinished(2000);
- QString ffmpegHelp = QString::fromAscii(proc.readAllStandardOutput());
- ffmpegAvailable = ffmpegHelp.contains(QLatin1String("-s "));
- ffmpegHelp = tr("Video recording uses ffmpeg:") + QLatin1String("\n\n") + ffmpegHelp;
-
- QDialog *d = new QDialog(recdlg);
- QVBoxLayout *l = new QVBoxLayout(d);
- QTextBrowser *b = new QTextBrowser(d);
- QFont f = b->font();
- f.setFamily(QLatin1String("courier"));
- b->setFont(f);
- b->setText(ffmpegHelp);
- l->addWidget(b);
- d->setLayout(l);
- ffmpegHelpWindow = d;
- connect(recdlg->ffmpegHelp,SIGNAL(clicked()), ffmpegHelpWindow, SLOT(show()));
-}
-
-void QDeclarativeViewer::setRecording(bool on)
-{
- if (on == recordTimer.isActive())
- return;
-
- int period = int(1000/record_rate+0.5);
- QUnifiedTimer::instance()->setTimingInterval(on ? period:16);
- QUnifiedTimer::instance()->setConsistentTiming(on);
- if (on) {
- canvas->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
- recordTimer.setInterval(period);
- recordTimer.start();
- frame_fmt = record_file.right(4).toLower();
- frame = QImage(canvas->width(),canvas->height(),QImage::Format_RGB32);
- if (frame_fmt != QLatin1String(".png") && (!convertAvailable || frame_fmt != QLatin1String(".gif"))) {
- // Stream video to ffmpeg
-
- QProcess *proc = new QProcess(this);
- connect(proc, SIGNAL(finished(int)), this, SLOT(ffmpegFinished(int)));
- frame_stream = proc;
-
- QStringList args;
- args << QLatin1String("-y");
- args << QLatin1String("-r") << QString::number(record_rate);
- args << QLatin1String("-f") << QLatin1String("rawvideo");
- args << QLatin1String("-pix_fmt") << (frame_fmt == QLatin1String(".gif") ? QLatin1String("rgb24") : QLatin1String("rgb32"));
- args << QLatin1String("-s") << QString::fromAscii("%1x%2").arg(canvas->width()).arg(canvas->height());
- args << QLatin1String("-i") << QLatin1String("-");
- if (record_outsize.isValid()) {
- args << QLatin1String("-s") << QString::fromAscii("%1x%2").arg(record_outsize.width()).arg(record_outsize.height());
- args << QLatin1String("-aspect") << QString::number(double(canvas->width())/canvas->height());
- }
- args += record_args;
- args << record_file;
- proc->start(QLatin1String("ffmpeg"), args);
-
- } else {
- // Store frames, save to GIF/PNG
- frame_stream = 0;
- }
- } else {
- canvas->setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate);
- recordTimer.stop();
- if (frame_stream) {
- qDebug() << "Saving video...";
- frame_stream->close();
- qDebug() << "Wrote" << record_file;
- } else {
- QProgressDialog progress(tr("Saving frames..."), tr("Cancel"), 0, frames.count()+10, this);
- progress.setWindowModality(Qt::WindowModal);
-
- int frame=0;
- QStringList inputs;
- qDebug() << "Saving frames...";
-
- QString framename;
- bool png_output = false;
- if (record_file.right(4).toLower() == QLatin1String(".png")) {
- if (record_file.contains(QLatin1Char('%')))
- framename = record_file;
- else
- framename = record_file.left(record_file.length()-4) + QLatin1String("%04d") + record_file.right(4);
- png_output = true;
- } else {
- framename = QLatin1String("tmp-frame%04d.png");
- png_output = false;
- }
- foreach (QImage* img, frames) {
- progress.setValue(progress.value()+1);
- if (progress.wasCanceled())
- break;
- QString name;
- name.sprintf(framename.toLocal8Bit(),frame++);
- if (record_outsize.isValid())
- *img = img->scaled(record_outsize,Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
- if (record_dither==QLatin1String("ordered"))
- img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither|Qt::OrderedDither).save(name);
- else if (record_dither==QLatin1String("threshold"))
- img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither|Qt::ThresholdDither).save(name);
- else if (record_dither==QLatin1String("floyd"))
- img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither).save(name);
- else
- img->save(name);
- inputs << name;
- delete img;
- }
-
- if (!progress.wasCanceled()) {
- if (png_output) {
- framename.replace(QRegExp(QLatin1String("%\\d*.")), QLatin1String("*"));
- qDebug() << "Wrote frames" << framename;
- inputs.clear(); // don't remove them
- } else {
- // ImageMagick and gifsicle for GIF encoding
- progress.setLabelText(tr("Converting frames to GIF file..."));
- QStringList args;
- args << QLatin1String("-delay") << QString::number(period/10);
- args << inputs;
- args << record_file;
- qDebug() << "Converting..." << record_file << "(this may take a while)";
- if (0!=QProcess::execute(QLatin1String("convert"), args)) {
- qWarning() << "Cannot run ImageMagick 'convert' - recorded frames not converted";
- inputs.clear(); // don't remove them
- qDebug() << "Wrote frames tmp-frame*.png";
- } else {
- if (record_file.right(4).toLower() == QLatin1String(".gif")) {
- qDebug() << "Compressing..." << record_file;
- if (0!=QProcess::execute(QLatin1String("gifsicle"), QStringList() << QLatin1String("-O2")
- << QLatin1String("-o") << record_file << record_file))
- qWarning() << "Cannot run 'gifsicle' - not compressed";
- }
- qDebug() << "Wrote" << record_file;
- }
- }
- }
-
- progress.setValue(progress.maximum()-1);
- foreach (QString name, inputs)
- QFile::remove(name);
-
- frames.clear();
- }
- }
- qDebug() << "Recording: " << (recordTimer.isActive()?"ON":"OFF");
-}
-
-void QDeclarativeViewer::ffmpegFinished(int code)
-{
- qDebug() << "ffmpeg returned" << code << frame_stream->readAllStandardError();
-}
-
-void QDeclarativeViewer::appAboutToQuit()
-{
- // avoid QGLContext errors about invalid contexts on exit
- canvas->setViewport(0);
-
- // avoid crashes if messages are received after app has closed
- delete loggerWindow;
- loggerWindow = 0;
- delete tester;
- tester = 0;
- close();
-}
-
-void QDeclarativeViewer::autoStartRecording()
-{
- setRecording(true);
- autoStopTimer.setInterval(record_autotime);
- autoStopTimer.start();
-}
-
-void QDeclarativeViewer::autoStopRecording()
-{
- setRecording(false);
-}
-
-void QDeclarativeViewer::recordFrame()
-{
- canvas->QWidget::render(&frame);
- if (frame_stream) {
- if (frame_fmt == QLatin1String(".gif")) {
- // ffmpeg can't do 32bpp with gif
- QImage rgb24 = frame.convertToFormat(QImage::Format_RGB888);
- frame_stream->write((char*)rgb24.bits(),rgb24.byteCount());
- } else {
- frame_stream->write((char*)frame.bits(),frame.byteCount());
- }
- } else {
- frames.append(new QImage(frame));
- }
-}
-
-void QDeclarativeViewer::changeOrientation(QAction *action)
-{
- if (!action)
- return;
- QString o = action->text();
- action->setChecked(true);
- if (o == QLatin1String("Portrait"))
- DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait);
- else if (o == QLatin1String("Landscape"))
- DeviceOrientation::instance()->setOrientation(DeviceOrientation::Landscape);
- else if (o == QLatin1String("Portrait (inverted)"))
- DeviceOrientation::instance()->setOrientation(DeviceOrientation::PortraitInverted);
- else if (o == QLatin1String("Landscape (inverted)"))
- DeviceOrientation::instance()->setOrientation(DeviceOrientation::LandscapeInverted);
-}
-
-void QDeclarativeViewer::orientationChanged()
-{
- updateSizeHints();
-}
-
-void QDeclarativeViewer::setDeviceKeys(bool on)
-{
- devicemode = on;
-}
-
-void QDeclarativeViewer::setNetworkCacheSize(int size)
-{
- namFactory->setCacheSize(size);
-}
-
-void QDeclarativeViewer::setUseGL(bool useGL)
-{
-#ifdef GL_SUPPORTED
- if (useGL) {
- QGLFormat format = QGLFormat::defaultFormat();
-#ifdef Q_OS_MAC
- format.setSampleBuffers(true);
- format.setSwapInterval(1);
-#else
- format.setSampleBuffers(false);
-#endif
-
- QGLWidget *glWidget = new QGLWidget(format);
- //### potentially faster, but causes junk to appear if top-level is Item, not Rectangle
- //glWidget->setAutoFillBackground(false);
-
- canvas->setViewport(glWidget);
- }
-#else
- Q_UNUSED(useGL)
-#endif
-}
-
-void QDeclarativeViewer::setUseNativeFileBrowser(bool use)
-{
- useQmlFileBrowser = !use;
-}
-
-void QDeclarativeViewer::setSizeToView(bool sizeToView)
-{
- QDeclarativeView::ResizeMode resizeMode = sizeToView ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject;
- if (resizeMode != canvas->resizeMode()) {
- canvas->setResizeMode(resizeMode);
- updateSizeHints();
- }
-}
-
-void QDeclarativeViewer::updateSizeHints(bool initial)
-{
- static bool isRecursive = false;
-
- if (isRecursive)
- return;
- isRecursive = true;
-
- if (initial || (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject)) {
- QSize newWindowSize = initial ? initialSize : canvas->sizeHint();
- //qWarning() << "USH:" << (initial ? "INIT:" : "V2R:") << "setting fixed size " << newWindowSize;
- if (!isFullScreen() && !isMaximized()) {
- canvas->setGeometry(0,0,newWindowSize.width(),newWindowSize.height());
- resize(1, 1);
- layout()->setSizeConstraint(QLayout::SetFixedSize);
- layout()->activate();
- }
- }
- //qWarning() << "USH: R2V: setting free size ";
- layout()->setSizeConstraint(QLayout::SetNoConstraint);
- layout()->activate();
- setMinimumSize(minimumSizeHint());
- setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
- canvas->setMinimumSize(QSize(0,0));
- canvas->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
-
- isRecursive = false;
-}
-
-void QDeclarativeViewer::registerTypes()
-{
- static bool registered = false;
-
- if (!registered) {
- // registering only for exposing the DeviceOrientation::Orientation enum
- qmlRegisterUncreatableType<DeviceOrientation>("Qt", 4, 7, "Orientation", QString());
- qmlRegisterUncreatableType<DeviceOrientation>("QtQuick", 1, 0, "Orientation", QString());
- registered = true;
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qmlruntime.moc"
diff --git a/tools/qmlviewer/qmlruntime.h b/tools/qmlviewer/qmlruntime.h
deleted file mode 100644
index 7f09e40b86..0000000000
--- a/tools/qmlviewer/qmlruntime.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVEVIEWER_H
-#define QDECLARATIVEVIEWER_H
-
-#include <QMainWindow>
-#include <QTimer>
-#include <QTime>
-#include <QList>
-
-#include "loggerwidget.h"
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeView;
-class PreviewDeviceSkin;
-class QDeclarativeTestEngine;
-class QProcess;
-class RecordingDialog;
-class QDeclarativeTester;
-class QNetworkReply;
-class QNetworkCookieJar;
-class NetworkAccessManagerFactory;
-class QTranslator;
-class QActionGroup;
-class QMenuBar;
-
-class QDeclarativeViewer
- : public QMainWindow
-{
- Q_OBJECT
-
-public:
- QDeclarativeViewer(QWidget *parent = 0, Qt::WindowFlags flags = 0);
- ~QDeclarativeViewer();
-
- static void registerTypes();
-
- enum ScriptOption {
- Play = 0x00000001,
- Record = 0x00000002,
- TestImages = 0x00000004,
- TestErrorProperty = 0x00000008,
- SaveOnExit = 0x00000010,
- ExitOnComplete = 0x00000020,
- ExitOnFailure = 0x00000040,
- Snapshot = 0x00000080,
- TestSkipProperty = 0x00000100
- };
- Q_DECLARE_FLAGS(ScriptOptions, ScriptOption)
- void setScript(const QString &s) { m_script = s; }
- void setScriptOptions(ScriptOptions opt) { m_scriptOptions = opt; }
- void setRecordDither(const QString& s) { record_dither = s; }
- void setRecordRate(int fps);
- void setRecordFile(const QString&);
- void setRecordArgs(const QStringList&);
- void setRecording(bool on);
- bool isRecording() const { return recordTimer.isActive(); }
- void setAutoRecord(int from, int to);
- void setDeviceKeys(bool);
- void setNetworkCacheSize(int size);
- void addLibraryPath(const QString& lib);
- void addPluginPath(const QString& plugin);
- void setUseGL(bool use);
- void setUseNativeFileBrowser(bool);
- void setSizeToView(bool sizeToView);
-
- QDeclarativeView *view() const;
- LoggerWidget *warningsWidget() const;
- QString currentFile() const { return currentFileOrUrl; }
-
- void enableExperimentalGestures();
-
-public slots:
- void sceneResized(QSize size);
- void initialSizeChanged(QSize size);
- bool open(const QString&);
- void openFile();
- void openUrl();
- void reload();
- void takeSnapShot();
- void toggleRecording();
- void toggleRecordingWithSelection();
- void ffmpegFinished(int code);
- void showProxySettings ();
- void proxySettingsChanged ();
- void rotateOrientation();
- void statusChanged();
- void setSlowMode(bool);
- void launch(const QString &);
-
-protected:
- virtual void keyPressEvent(QKeyEvent *);
- virtual bool event(QEvent *);
- void createMenu();
-
-private slots:
- void appAboutToQuit();
-
- void autoStartRecording();
- void autoStopRecording();
- void recordFrame();
- void chooseRecordingOptions();
- void pickRecordingFile();
- void toggleFullScreen();
- void changeOrientation(QAction*);
- void orientationChanged();
-
- void showWarnings(bool show);
- void warningsWidgetOpened();
- void warningsWidgetClosed();
-
-private:
- void updateSizeHints(bool initial = false);
-
- QString getVideoFileName();
-
- LoggerWidget *loggerWindow;
- QDeclarativeView *canvas;
- QSize initialSize;
- QString currentFileOrUrl;
- QTimer recordTimer;
- QString frame_fmt;
- QImage frame;
- QList<QImage*> frames;
- QProcess* frame_stream;
- QTimer autoStartTimer;
- QTimer autoStopTimer;
- QString record_dither;
- QString record_file;
- QSize record_outsize;
- QStringList record_args;
- int record_rate;
- int record_autotime;
- bool devicemode;
- QAction *recordAction;
- RecordingDialog *recdlg;
-
- void senseImageMagick();
- void senseFfmpeg();
- QWidget *ffmpegHelpWindow;
- bool ffmpegAvailable;
- bool convertAvailable;
-
- QAction *rotateAction;
- QActionGroup *orientation;
- QAction *showWarningsWindow;
-
- QString m_script;
- ScriptOptions m_scriptOptions;
- QDeclarativeTester *tester;
-
- NetworkAccessManagerFactory *namFactory;
-
- bool useQmlFileBrowser;
-
- QTranslator *translator;
- void loadTranslationFile(const QString& directory);
-
- void loadDummyDataFiles(const QString& directory);
-};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeViewer::ScriptOptions)
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/tools/qmlviewer/qmlviewer.pro b/tools/qmlviewer/qmlviewer.pro
deleted file mode 100644
index 980c1d4b3c..0000000000
--- a/tools/qmlviewer/qmlviewer.pro
+++ /dev/null
@@ -1,26 +0,0 @@
-TEMPLATE = app
-CONFIG += qt uic declarative_debug
-DESTDIR = $$QT.declarative.bins
-QT += declarative qtquick1 qtquick1-private widgets widgets-private
-
-include(qml.pri)
-
-SOURCES += main.cpp
-
-INCLUDEPATH += ../../include/QtDeclarative
-INCLUDEPATH += ../../src/declarative/util
-INCLUDEPATH += ../../src/declarative/graphicsitems
-INCLUDEPATH += ../../src/3rdparty/v8/include
-
-DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
-
-target.path = $$[QT_INSTALL_BINS]
-INSTALLS += target
-
-mac {
- QMAKE_INFO_PLIST=Info_mac.plist
- TARGET=QMLViewer
- ICON=qml.icns
-} else {
- TARGET=qmlviewer
-}
diff --git a/tools/qmlviewer/recopts.ui b/tools/qmlviewer/recopts.ui
deleted file mode 100644
index ce2da30767..0000000000
--- a/tools/qmlviewer/recopts.ui
+++ /dev/null
@@ -1,513 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>RecordingOptions</class>
- <widget class="QDialog" name="RecordingOptions">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>316</width>
- <height>436</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Video options</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QLabel" name="label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>File:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="file"/>
- </item>
- <item>
- <widget class="QToolButton" name="pickfile">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Size</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QRadioButton" name="sizeOriginal">
- <property name="text">
- <string/>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QRadioButton" name="sizeVGA">
- <property name="text">
- <string>VGA</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QRadioButton" name="size720p">
- <property name="text">
- <string>720p</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QRadioButton" name="sizeQVGA">
- <property name="text">
- <string>QVGA</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="3">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QRadioButton" name="sizeCustom">
- <property name="text">
- <string>Width:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="sizeWidth">
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>9999</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Height:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="sizeHeight">
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>9999</number>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::MinimumExpanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item row="0" column="2">
- <spacer name="horizontalSpacer_4">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::MinimumExpanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="rateOptions">
- <property name="title">
- <string>Rate</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
- <widget class="QRadioButton" name="hz60">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>60Hz</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QRadioButton" name="hz50">
- <property name="text">
- <string>50Hz</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QRadioButton" name="hz25">
- <property name="text">
- <string>25Hz</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="4">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="QRadioButton" name="hzCustom">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="hz">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>60</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>100</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Hz</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::MinimumExpanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item row="1" column="2">
- <widget class="QRadioButton" name="hz24">
- <property name="text">
- <string>24Hz</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::MinimumExpanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="1">
- <spacer name="horizontalSpacer_5">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="ffmpegOptions">
- <property name="title">
- <string>Profile</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0" colspan="3">
- <widget class="QComboBox" name="profile"/>
- </item>
- <item row="1" column="0" colspan="2">
- <widget class="QLineEdit" name="args"/>
- </item>
- <item row="1" column="2">
- <widget class="QToolButton" name="ffmpegHelp">
- <property name="text">
- <string>Help</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="warning">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <tabstops>
- <tabstop>file</tabstop>
- <tabstop>pickfile</tabstop>
- <tabstop>sizeOriginal</tabstop>
- <tabstop>sizeVGA</tabstop>
- <tabstop>size720p</tabstop>
- <tabstop>sizeQVGA</tabstop>
- <tabstop>sizeCustom</tabstop>
- <tabstop>sizeWidth</tabstop>
- <tabstop>sizeHeight</tabstop>
- <tabstop>hz60</tabstop>
- <tabstop>hz25</tabstop>
- <tabstop>hz50</tabstop>
- <tabstop>hz24</tabstop>
- <tabstop>hzCustom</tabstop>
- <tabstop>hz</tabstop>
- <tabstop>profile</tabstop>
- <tabstop>args</tabstop>
- <tabstop>ffmpegHelp</tabstop>
- <tabstop>buttonBox</tabstop>
- </tabstops>
- <resources/>
- <connections>
- <connection>
- <sender>hzCustom</sender>
- <signal>clicked()</signal>
- <receiver>hz</receiver>
- <slot>setFocus()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>43</x>
- <y>257</y>
- </hint>
- <hint type="destinationlabel">
- <x>129</x>
- <y>262</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>hz</sender>
- <signal>textChanged(QString)</signal>
- <receiver>hzCustom</receiver>
- <slot>toggle()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>143</x>
- <y>262</y>
- </hint>
- <hint type="destinationlabel">
- <x>43</x>
- <y>257</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>hz</sender>
- <signal>selectionChanged()</signal>
- <receiver>hzCustom</receiver>
- <slot>toggle()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>143</x>
- <y>262</y>
- </hint>
- <hint type="destinationlabel">
- <x>43</x>
- <y>257</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>RecordingOptions</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>258</x>
- <y>424</y>
- </hint>
- <hint type="destinationlabel">
- <x>60</x>
- <y>219</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>RecordingOptions</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>258</x>
- <y>424</y>
- </hint>
- <hint type="destinationlabel">
- <x>92</x>
- <y>219</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>profile</sender>
- <signal>activated(int)</signal>
- <receiver>RecordingOptions</receiver>
- <slot>pickProfile(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>92</x>
- <y>329</y>
- </hint>
- <hint type="destinationlabel">
- <x>48</x>
- <y>194</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>args</sender>
- <signal>textEdited(QString)</signal>
- <receiver>RecordingOptions</receiver>
- <slot>storeCustomArgs(QString)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>128</x>
- <y>357</y>
- </hint>
- <hint type="destinationlabel">
- <x>102</x>
- <y>189</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>sizeWidth</sender>
- <signal>valueChanged(int)</signal>
- <receiver>sizeCustom</receiver>
- <slot>toggle()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>108</x>
- <y>133</y>
- </hint>
- <hint type="destinationlabel">
- <x>48</x>
- <y>133</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>sizeHeight</sender>
- <signal>valueChanged(int)</signal>
- <receiver>sizeCustom</receiver>
- <slot>toggle()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>212</x>
- <y>133</y>
- </hint>
- <hint type="destinationlabel">
- <x>64</x>
- <y>129</y>
- </hint>
- </hints>
- </connection>
- </connections>
- <slots>
- <signal>filePicked(QString)</signal>
- <signal>argumentsPicked(QString)</signal>
- <slot>pickFile()</slot>
- <slot>pickProfile(int)</slot>
- <slot>storeCustomArgs(QString)</slot>
- </slots>
-</ui>
diff --git a/tools/qmlviewer/startup/Logo.qml b/tools/qmlviewer/startup/Logo.qml
deleted file mode 100644
index 177b41561c..0000000000
--- a/tools/qmlviewer/startup/Logo.qml
+++ /dev/null
@@ -1,179 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $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"
- }
- }
-}
diff --git a/tools/qmlviewer/startup/qt-back.png b/tools/qmlviewer/startup/qt-back.png
deleted file mode 100644
index 077215f882..0000000000
--- a/tools/qmlviewer/startup/qt-back.png
+++ /dev/null
Binary files differ
diff --git a/tools/qmlviewer/startup/qt-blue.jpg b/tools/qmlviewer/startup/qt-blue.jpg
deleted file mode 100644
index b204896483..0000000000
--- a/tools/qmlviewer/startup/qt-blue.jpg
+++ /dev/null
Binary files differ
diff --git a/tools/qmlviewer/startup/qt-front.png b/tools/qmlviewer/startup/qt-front.png
deleted file mode 100644
index dbfb43e374..0000000000
--- a/tools/qmlviewer/startup/qt-front.png
+++ /dev/null
Binary files differ
diff --git a/tools/qmlviewer/startup/qt-sketch.jpg b/tools/qmlviewer/startup/qt-sketch.jpg
deleted file mode 100644
index 1ede6f079b..0000000000
--- a/tools/qmlviewer/startup/qt-sketch.jpg
+++ /dev/null
Binary files differ
diff --git a/tools/qmlviewer/startup/qt-text.png b/tools/qmlviewer/startup/qt-text.png
deleted file mode 100644
index d44995c9b3..0000000000
--- a/tools/qmlviewer/startup/qt-text.png
+++ /dev/null
Binary files differ
diff --git a/tools/qmlviewer/startup/quick-blur.png b/tools/qmlviewer/startup/quick-blur.png
deleted file mode 100644
index 29ec243387..0000000000
--- a/tools/qmlviewer/startup/quick-blur.png
+++ /dev/null
Binary files differ
diff --git a/tools/qmlviewer/startup/quick-regular.png b/tools/qmlviewer/startup/quick-regular.png
deleted file mode 100644
index 38321cbf19..0000000000
--- a/tools/qmlviewer/startup/quick-regular.png
+++ /dev/null
Binary files differ
diff --git a/tools/qmlviewer/startup/shadow.png b/tools/qmlviewer/startup/shadow.png
deleted file mode 100644
index 44f92fee73..0000000000
--- a/tools/qmlviewer/startup/shadow.png
+++ /dev/null
Binary files differ
diff --git a/tools/qmlviewer/startup/startup.qml b/tools/qmlviewer/startup/startup.qml
deleted file mode 100644
index c843ad20ed..0000000000
--- a/tools/qmlviewer/startup/startup.qml
+++ /dev/null
@@ -1,173 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $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: 3
- 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
diff --git a/tools/qmlviewer/startup/startup.qrc b/tools/qmlviewer/startup/startup.qrc
deleted file mode 100644
index 52e67050d9..0000000000
--- a/tools/qmlviewer/startup/startup.qrc
+++ /dev/null
@@ -1,16 +0,0 @@
-<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>
diff --git a/tools/qmlviewer/startup/white-star.png b/tools/qmlviewer/startup/white-star.png
deleted file mode 100644
index f467c9480e..0000000000
--- a/tools/qmlviewer/startup/white-star.png
+++ /dev/null
Binary files differ
diff --git a/tools/tools.pro b/tools/tools.pro
index 46d381dee9..207299bbfb 100644
--- a/tools/tools.pro
+++ b/tools/tools.pro
@@ -1,5 +1,5 @@
TEMPLATE = subdirs
-SUBDIRS += qmlviewer qmlscene qmlplugindump qmlmin qmleasing
+SUBDIRS += qmlscene qmlplugindump qmlmin qmleasing
contains(QT_CONFIG, qmltest): SUBDIRS += qmltestrunner