From 688791b4d39ed4e96c43621e28c6bb3098d3b70c Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 29 Jul 2010 16:20:48 +1000 Subject: Improve utility of QMLViewer Adds a startup animation for all platforms, and adds support for file associated and drag and drop on Mac OS X QTBUG-12496 --- tools/qml/Info_mac.plist | 31 +++ tools/qml/browser/Browser.qml | 284 ++++++++++++++++++++ tools/qml/browser/browser.qrc | 9 + tools/qml/browser/images/folder.png | Bin 0 -> 1841 bytes tools/qml/browser/images/titlebar.png | Bin 0 -> 1436 bytes tools/qml/browser/images/titlebar.sci | 5 + tools/qml/browser/images/up.png | Bin 0 -> 662 bytes tools/qml/content/Browser.qml | 284 -------------------- tools/qml/content/images/folder.png | Bin 1841 -> 0 bytes tools/qml/content/images/titlebar.png | Bin 1436 -> 0 bytes tools/qml/content/images/titlebar.sci | 5 - tools/qml/content/images/up.png | Bin 662 -> 0 bytes tools/qml/main.cpp | 476 +++++++++++++++++++++------------- tools/qml/qml.pri | 4 +- tools/qml/qmlruntime.cpp | 62 ++++- tools/qml/qmlruntime.h | 1 + tools/qml/qmlruntime.qrc | 9 - tools/qml/startup/Logo.qml | 138 ++++++++++ tools/qml/startup/qt-back.png | Bin 0 -> 3549 bytes tools/qml/startup/qt-blue.jpg | Bin 0 -> 20900 bytes tools/qml/startup/qt-front.png | Bin 0 -> 3318 bytes tools/qml/startup/qt-sketch.jpg | Bin 0 -> 17048 bytes tools/qml/startup/qt-text.png | Bin 0 -> 14565 bytes tools/qml/startup/quick-blur.png | Bin 0 -> 2826 bytes tools/qml/startup/quick-regular.png | Bin 0 -> 1399 bytes tools/qml/startup/shadow.png | Bin 0 -> 1592 bytes tools/qml/startup/startup.qml | 126 +++++++++ tools/qml/startup/startup.qrc | 16 ++ tools/qml/startup/white-star.png | Bin 0 -> 2651 bytes 29 files changed, 968 insertions(+), 482 deletions(-) create mode 100644 tools/qml/browser/Browser.qml create mode 100644 tools/qml/browser/browser.qrc create mode 100644 tools/qml/browser/images/folder.png create mode 100644 tools/qml/browser/images/titlebar.png create mode 100644 tools/qml/browser/images/titlebar.sci create mode 100644 tools/qml/browser/images/up.png delete mode 100644 tools/qml/content/Browser.qml delete mode 100644 tools/qml/content/images/folder.png delete mode 100644 tools/qml/content/images/titlebar.png delete mode 100644 tools/qml/content/images/titlebar.sci delete mode 100644 tools/qml/content/images/up.png delete mode 100644 tools/qml/qmlruntime.qrc create mode 100644 tools/qml/startup/Logo.qml create mode 100644 tools/qml/startup/qt-back.png create mode 100644 tools/qml/startup/qt-blue.jpg create mode 100644 tools/qml/startup/qt-front.png create mode 100644 tools/qml/startup/qt-sketch.jpg create mode 100644 tools/qml/startup/qt-text.png create mode 100644 tools/qml/startup/quick-blur.png create mode 100644 tools/qml/startup/quick-regular.png create mode 100644 tools/qml/startup/shadow.png create mode 100644 tools/qml/startup/startup.qml create mode 100644 tools/qml/startup/startup.qrc create mode 100644 tools/qml/startup/white-star.png diff --git a/tools/qml/Info_mac.plist b/tools/qml/Info_mac.plist index 80ca6a3..0877547 100644 --- a/tools/qml/Info_mac.plist +++ b/tools/qml/Info_mac.plist @@ -14,5 +14,36 @@ @TYPEINFO@ CFBundleExecutable @EXECUTABLE@ + UTExportedTypeDeclarations + + + UTTypeIdentifier + com.nokia.qt.qml + UTTypeDescription + Qt Markup Language + UTTypeConformsTo + + public.plain-text + + UTTypeTagSpecification + + public.filename-extension + + qml + + + + + CFBundleDocumentTypes + + + LSItemContentTypes + + com.nokia.qt.qml + + CFBundleTypeRole + Viewer + + diff --git a/tools/qml/browser/Browser.qml b/tools/qml/browser/Browser.qml new file mode 100644 index 0000000..ff2bb47 --- /dev/null +++ b/tools/qml/browser/Browser.qml @@ -0,0 +1,284 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 +import Qt.labs.folderlistmodel 1.0 + +Rectangle { + id: root + property bool keyPressed: 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; + } + + 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 + 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.keyPressed) ? palette.highlightedText : palette.windowText + elide: Text.ElideRight + } + MouseArea { + id: mouseRegion + anchors.fill: parent + 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.keyPressed && view1.count != 0 } + 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 = true; } + } + + 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.keyPressed && view2.count != 0 } + 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 = true; } + } + + Keys.onPressed: { + root.keyPressed = true; + 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/qml/browser/browser.qrc b/tools/qml/browser/browser.qrc new file mode 100644 index 0000000..9c688e7 --- /dev/null +++ b/tools/qml/browser/browser.qrc @@ -0,0 +1,9 @@ + + + Browser.qml + images/up.png + images/folder.png + images/titlebar.sci + images/titlebar.png + + diff --git a/tools/qml/browser/images/folder.png b/tools/qml/browser/images/folder.png new file mode 100644 index 0000000..e53e2ad Binary files /dev/null and b/tools/qml/browser/images/folder.png differ diff --git a/tools/qml/browser/images/titlebar.png b/tools/qml/browser/images/titlebar.png new file mode 100644 index 0000000..51c9008 Binary files /dev/null and b/tools/qml/browser/images/titlebar.png differ diff --git a/tools/qml/browser/images/titlebar.sci b/tools/qml/browser/images/titlebar.sci new file mode 100644 index 0000000..0418d94 --- /dev/null +++ b/tools/qml/browser/images/titlebar.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 12 +border.bottom: 12 +border.right: 10 +source: titlebar.png diff --git a/tools/qml/browser/images/up.png b/tools/qml/browser/images/up.png new file mode 100644 index 0000000..b05f802 Binary files /dev/null and b/tools/qml/browser/images/up.png differ diff --git a/tools/qml/content/Browser.qml b/tools/qml/content/Browser.qml deleted file mode 100644 index ff2bb47..0000000 --- a/tools/qml/content/Browser.qml +++ /dev/null @@ -1,284 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt 4.7 -import Qt.labs.folderlistmodel 1.0 - -Rectangle { - id: root - property bool keyPressed: 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; - } - - 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 - 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.keyPressed) ? palette.highlightedText : palette.windowText - elide: Text.ElideRight - } - MouseArea { - id: mouseRegion - anchors.fill: parent - 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.keyPressed && view1.count != 0 } - 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 = true; } - } - - 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.keyPressed && view2.count != 0 } - 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 = true; } - } - - Keys.onPressed: { - root.keyPressed = true; - 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/qml/content/images/folder.png b/tools/qml/content/images/folder.png deleted file mode 100644 index e53e2ad..0000000 Binary files a/tools/qml/content/images/folder.png and /dev/null differ diff --git a/tools/qml/content/images/titlebar.png b/tools/qml/content/images/titlebar.png deleted file mode 100644 index 51c9008..0000000 Binary files a/tools/qml/content/images/titlebar.png and /dev/null differ diff --git a/tools/qml/content/images/titlebar.sci b/tools/qml/content/images/titlebar.sci deleted file mode 100644 index 0418d94..0000000 --- a/tools/qml/content/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/qml/content/images/up.png b/tools/qml/content/images/up.png deleted file mode 100644 index b05f802..0000000 Binary files a/tools/qml/content/images/up.png and /dev/null differ diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 4b1162e..7421b5e 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -56,7 +56,8 @@ QT_USE_NAMESPACE QtMsgHandler systemMsgOutput = 0; - +static QDeclarativeViewer *openFile(const QString &fileName); +static void showViewer(QDeclarativeViewer *viewer); #if defined (Q_OS_SYMBIAN) #include @@ -117,6 +118,11 @@ void myMessageOutput(QtMsgType type, const char *msg) #endif +static QDeclarativeViewer* globalViewer = 0; + +// The qml file that is shown if the user didn't specify a QML file +QString initialFile = "qrc:/startup/startup.qml"; + void usage() { qWarning("Usage: qmlviewer [options] "); @@ -175,135 +181,200 @@ void scriptOptsUsage() enum WarningsConfig { ShowWarnings, HideWarnings, DefaultWarnings }; -int main(int argc, char ** argv) +struct ViewerOptions { -#if defined (Q_OS_SYMBIAN) - qInstallMsgHandler(myMessageOutput); -#else - systemMsgOutput = qInstallMsgHandler(myMessageOutput); + ViewerOptions() + : frameless(false), + fps(0.0), + autorecord_from(0), + autorecord_to(0), + dither("none"), + runScript(false), + devkeys(false), + cache(0), + useGL(false), + fullScreen(false), + stayOnTop(false), + maximized(false), + useNativeFileBrowser(true), + experimentalGestures(false), + warningsConfig(DefaultWarnings), + sizeToView(true) + { +#if defined(Q_OS_SYMBIAN) + maximized = true; + useNativeFileBrowser = false; #endif -#if defined (Q_OS_WIN) - // Debugging output is not visible by default on Windows - - // therefore show modal dialog with errors instad. - atexit(showWarnings); +#if defined(Q_WS_MAC) + useGL = true; #endif - -#if defined (Q_WS_X11) || defined (Q_WS_MAC) - //### default to using raster graphics backend for now - bool gsSpecified = false; - for (int i = 0; i < argc; ++i) { - QString arg = argv[i]; - if (arg == "-graphicssystem") { - gsSpecified = true; - break; - } } - if (!gsSpecified) - QApplication::setGraphicsSystem("raster"); -#endif - - QApplication app(argc, argv); - app.setApplicationName("QtQmlViewer"); - app.setOrganizationName("Nokia"); - app.setOrganizationDomain("nokia.com"); - - - - QDeclarativeViewer::registerTypes(); - QDeclarativeTester::registerTypes(); - - bool frameless = false; - QString fileName; - double fps = 0; - int autorecord_from = 0; - int autorecord_to = 0; - QString dither = "none"; + 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 = false; - bool devkeys = false; - int cache = 0; + bool runScript; + bool devkeys; + int cache; QString translationFile; - bool useGL = false; - bool fullScreen = false; - bool stayOnTop = false; - bool maximized = false; - bool useNativeFileBrowser = true; - bool experimentalGestures = false; + bool useGL; + bool fullScreen; + bool stayOnTop; + bool maximized; + bool useNativeFileBrowser; + bool experimentalGestures; - WarningsConfig warningsConfig = DefaultWarnings; - bool sizeToView = true; + WarningsConfig warningsConfig; + bool sizeToView; -#if defined(Q_OS_SYMBIAN) - maximized = true; - useNativeFileBrowser = false; -#endif + QDeclarativeViewer::ScriptOptions scriptOptions; +}; -#if defined(Q_WS_MAC) - useGL = true; -#endif +static ViewerOptions opts; +static QStringList fileNames; - for (int i = 1; i < argc; ++i) { - bool lastArg = (i == argc - 1); - QString arg = argv[i]; +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(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("exitoncomplete")) { + scriptOptions |= QDeclarativeViewer::ExitOnComplete; + } else if (option == QLatin1String("exitonfailure")) { + scriptOptions |= QDeclarativeViewer::ExitOnFailure; + } else if (option == QLatin1String("saveonexit")) { + scriptOptions |= QDeclarativeViewer::SaveOnExit; + } else if (option == QLatin1String("snapshot")) { + scriptOptions |= QDeclarativeViewer::Snapshot; + } else { + scriptOptsUsage(); + } + } + + opts.scriptOptions = scriptOptions; +} + +static void parseCommandLineOptions(const QStringList &arguments) +{ + for (int i = 1; i < arguments.count(); ++i) { + bool lastArg = (i == arguments.count() - 1); + QString arg = arguments.at(i); if (arg == "-frameless") { - frameless = true; + opts.frameless = true; } else if (arg == "-maximized") { - maximized = true; + opts.maximized = true; } else if (arg == "-fullscreen") { - fullScreen = true; + opts.fullScreen = true; } else if (arg == "-stayontop") { - stayOnTop = true; + opts.stayOnTop = true; } else if (arg == "-netcache") { if (lastArg) usage(); - cache = QString(argv[++i]).toInt(); + opts.cache = arguments.at(++i).toInt(); } else if (arg == "-recordrate") { if (lastArg) usage(); - fps = QString(argv[++i]).toDouble(); + opts.fps = arguments.at(++i).toDouble(); } else if (arg == "-recordfile") { if (lastArg) usage(); - recordfile = QString(argv[++i]); + opts.recordfile = arguments.at(++i); } else if (arg == "-record") { if (lastArg) usage(); - recordargs << QString(argv[++i]); + opts.recordargs << arguments.at(++i); } else if (arg == "-recorddither") { if (lastArg) usage(); - dither = QString(argv[++i]); + opts.dither = arguments.at(++i); } else if (arg == "-autorecord") { if (lastArg) usage(); - QString range = QString(argv[++i]); + QString range = arguments.at(++i); int dash = range.indexOf('-'); if (dash > 0) - autorecord_from = range.left(dash).toInt(); - autorecord_to = range.mid(dash+1).toInt(); + opts.autorecord_from = range.left(dash).toInt(); + opts.autorecord_to = range.mid(dash+1).toInt(); } else if (arg == "-devicekeys") { - devkeys = true; + opts.devkeys = true; } else if (arg == "-dragthreshold") { if (lastArg) usage(); - app.setStartDragDistance(QString(argv[++i]).toInt()); + qApp->setStartDragDistance(arguments.at(++i).toInt()); } else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) { qWarning("Qt QML Viewer version %s", QT_VERSION_STR); exit(0); } else if (arg == "-translation") { if (lastArg) usage(); - translationFile = argv[++i]; + opts.translationFile = arguments.at(++i); } else if (arg == "-opengl") { - useGL = true; + opts.useGL = true; } else if (arg == "-qmlbrowser") { - useNativeFileBrowser = false; + opts.useNativeFileBrowser = false; } else if (arg == "-warnings") { if (lastArg) usage(); - QString warningsStr = QString(argv[++i]); + QString warningsStr = arguments.at(++i); if (warningsStr == QLatin1String("show")) { - warningsConfig = ShowWarnings; + opts.warningsConfig = ShowWarnings; } else if (warningsStr == QLatin1String("hide")) { - warningsConfig = HideWarnings; + opts.warningsConfig = HideWarnings; } else { usage(); } @@ -316,152 +387,203 @@ int main(int argc, char ** argv) qWarning("Current search path: %s", paths.toLocal8Bit().constData()); exit(0); } - imports << QString(argv[++i]); + opts.imports << arguments.at(++i); } else if (arg == "-P") { if (lastArg) usage(); - plugins << QString(argv[++i]); + opts.plugins << arguments.at(++i); } else if (arg == "-script") { if (lastArg) usage(); - script = QString(argv[++i]); + opts.script = arguments.at(++i); } else if (arg == "-scriptopts") { if (lastArg) usage(); - scriptopts = QString(argv[++i]); + opts.scriptopts = arguments.at(++i); } else if (arg == "-savescript") { if (lastArg) usage(); - script = QString(argv[++i]); - runScript = false; + opts.script = arguments.at(++i); + opts.runScript = false; } else if (arg == "-playscript") { if (lastArg) usage(); - script = QString(argv[++i]); - runScript = true; + opts.script = arguments.at(++i); + opts.runScript = true; } else if (arg == "-sizeviewtorootobject") { - sizeToView = false; + opts.sizeToView = false; } else if (arg == "-sizerootobjecttoview") { - sizeToView = true; + opts.sizeToView = true; } else if (arg == "-experimentalgestures") { - experimentalGestures = true; - } else if (arg[0] != '-') { - fileName = arg; - } else if (1 || arg == "-help") { + opts.experimentalGestures = true; + } else if (!arg.startsWith('-')) { + fileNames.append(arg); + } else if (true || arg == "-help") { usage(); } } - QTranslator qmlTranslator; - if (!translationFile.isEmpty()) { - qmlTranslator.load(translationFile); - app.installTranslator(&qmlTranslator); + 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(); } - Qt::WFlags wflags = (frameless ? Qt::FramelessWindowHint : Qt::Widget); - if (stayOnTop) +} + +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); - if (!scriptopts.isEmpty()) { - QStringList options = - scriptopts.split(QLatin1Char(','), QString::SkipEmptyParts); - - QDeclarativeViewer::ScriptOptions scriptOptions = 0; - for (int i = 0; i < options.count(); ++i) { - const QString &option = options.at(i); - if (option == QLatin1String("help")) { - scriptOptsUsage(); - } else if (option == QLatin1String("play")) { - scriptOptions |= QDeclarativeViewer::Play; - } else if (option == QLatin1String("record")) { - scriptOptions |= QDeclarativeViewer::Record; - } else if (option == QLatin1String("testimages")) { - scriptOptions |= QDeclarativeViewer::TestImages; - } else if (option == QLatin1String("testerror")) { - scriptOptions |= QDeclarativeViewer::TestErrorProperty; - } else if (option == QLatin1String("exitoncomplete")) { - scriptOptions |= QDeclarativeViewer::ExitOnComplete; - } else if (option == QLatin1String("exitonfailure")) { - scriptOptions |= QDeclarativeViewer::ExitOnFailure; - } else if (option == QLatin1String("saveonexit")) { - scriptOptions |= QDeclarativeViewer::SaveOnExit; - } else if (option == QLatin1String("snapshot")) { - scriptOptions |= QDeclarativeViewer::Snapshot; - } else { - scriptOptsUsage(); - } - } - - if (script.isEmpty()) - usage(); - if (!(scriptOptions & QDeclarativeViewer::Record) && !(scriptOptions & QDeclarativeViewer::Play)) - scriptOptsUsage(); - viewer->setScriptOptions(scriptOptions); - viewer->setScript(script); - } else if (!script.isEmpty()) { - usage(); + if (!opts.scriptopts.isEmpty()) { + viewer->setScriptOptions(opts.scriptOptions); + viewer->setScript(opts.script); } #if !defined(Q_OS_SYMBIAN) logger = viewer->warningsWidget(); - if (warningsConfig == ShowWarnings) { + if (opts.warningsConfig == ShowWarnings) { logger.data()->setDefaultVisibility(LoggerWidget::ShowWarnings); logger.data()->show(); - } else if (warningsConfig == HideWarnings){ + } else if (opts.warningsConfig == HideWarnings){ logger.data()->setDefaultVisibility(LoggerWidget::HideWarnings); } #endif - if (experimentalGestures) + if (opts.experimentalGestures) viewer->enableExperimentalGestures(); - foreach (QString lib, imports) + foreach (QString lib, opts.imports) viewer->addLibraryPath(lib); - foreach (QString plugin, plugins) + foreach (QString plugin, opts.plugins) viewer->addPluginPath(plugin); - viewer->setNetworkCacheSize(cache); - viewer->setRecordFile(recordfile); - viewer->setSizeToView(sizeToView); - if (fps>0) - viewer->setRecordRate(fps); - if (autorecord_to) - viewer->setAutoRecord(autorecord_from,autorecord_to); - if (devkeys) + viewer->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(dither); - if (recordargs.count()) - viewer->setRecordArgs(recordargs); + viewer->setRecordDither(opts.dither); + if (opts.recordargs.count()) + viewer->setRecordArgs(opts.recordargs); + + viewer->setUseNativeFileBrowser(opts.useNativeFileBrowser); - viewer->setUseNativeFileBrowser(useNativeFileBrowser); - if (fullScreen && maximized) + return viewer; +} + +void showViewer(QDeclarativeViewer *viewer) +{ + if (opts.fullScreen) + viewer->showFullScreen(); + else if (opts.maximized) + viewer->showMaximized(); + else + viewer->show(); + + viewer->setUseGL(opts.useGL); + viewer->raise(); +} + +QDeclarativeViewer *openFile(const QString &fileName) +{ + QDeclarativeViewer *viewer = globalViewer; + + viewer->open(fileName); + showViewer(viewer); + + return viewer; +} + +int main(int argc, char ** argv) +{ +#if defined (Q_OS_SYMBIAN) + qInstallMsgHandler(myMessageOutput); +#else + systemMsgOutput = qInstallMsgHandler(myMessageOutput); +#endif + +#if defined (Q_OS_WIN) + // Debugging output is not visible by default on Windows - + // therefore show modal dialog with errors instad. + atexit(showWarnings); +#endif + +#if defined (Q_WS_X11) || defined (Q_WS_MAC) + //### default to using raster graphics backend for now + bool gsSpecified = false; + for (int i = 0; i < argc; ++i) { + QString arg = argv[i]; + if (arg == "-graphicssystem") { + gsSpecified = true; + break; + } + } + + if (!gsSpecified) + QApplication::setGraphicsSystem("raster"); +#endif + + Application app(argc, argv); + app.setApplicationName("QtQmlViewer"); + app.setOrganizationName("Nokia"); + app.setOrganizationDomain("nokia.com"); + + QDeclarativeViewer::registerTypes(); + QDeclarativeTester::registerTypes(); + + parseCommandLineOptions(app.arguments()); + + QTranslator qmlTranslator; + if (!opts.translationFile.isEmpty()) { + qmlTranslator.load(opts.translationFile); + app.installTranslator(&qmlTranslator); + } + + if (opts.fullScreen && opts.maximized) qWarning() << "Both -fullscreen and -maximized specified. Using -fullscreen."; - if (fileName.isEmpty()) { + 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) - fileName = content.left(newline); - else - fileName = content; - } + QString content = QString::fromUtf8(qmlapp.readAll()); + qmlapp.close(); + + int newline = content.indexOf(QLatin1Char('\n')); + if (newline >= 0) + fileNames += content.left(newline); + else + fileNames += content; + } } - if (!fileName.isEmpty()) { - viewer->open(fileName); - fullScreen ? viewer->showFullScreen() : maximized ? viewer->showMaximized() : viewer->show(); + globalViewer = createViewer(); + + if (fileNames.isEmpty()) { + // show the initial viewer delayed. + // This prevents an initial viewer popping up while there + // are FileOpen events coming through the event queue + QTimer::singleShot(1, &app, SLOT(showInitialViewer())); } else { - if (!useNativeFileBrowser) - viewer->openFile(); - fullScreen ? viewer->showFullScreen() : maximized ? viewer->showMaximized() : viewer->show(); - if (useNativeFileBrowser) - viewer->openFile(); + foreach (const QString &fileName, fileNames) + openFile(fileName); } - viewer->setUseGL(useGL); - viewer->raise(); + + QObject::connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); return app.exec(); } + +#include "main.moc" diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri index 80afb45..e5b2c7f 100644 --- a/tools/qml/qml.pri +++ b/tools/qml/qml.pri @@ -16,7 +16,9 @@ SOURCES += $$PWD/qmlruntime.cpp \ $$PWD/qdeclarativetester.cpp \ $$PWD/loggerwidget.cpp -RESOURCES = $$PWD/qmlruntime.qrc +RESOURCES = $$PWD/browser/browser.qrc \ + $$PWD/startup/startup.qrc + symbian:!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { SOURCES += $$PWD/deviceorientation_symbian.cpp FORMS = $$PWD/recopts.ui \ diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 951b187..08a578c 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -102,6 +102,49 @@ 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 urlList = mimeData->urls(); + foreach (const QUrl &url, urlList) { + if (url.scheme() == QLatin1String("file")) { + static_cast(parent())->open(url.toLocalFile()); + event->accept(); + return; + } + } + } +}; + class Runtime : public QObject { Q_OBJECT @@ -596,7 +639,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) recdlg->warning->hide(); } - canvas = new QDeclarativeView(this); + canvas = new DragAndDropView(this); canvas->setAttribute(Qt::WA_OpaquePaintEvent); canvas->setAttribute(Qt::WA_NoSystemBackground); @@ -605,7 +648,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize))); QObject::connect(canvas, SIGNAL(statusChanged(QDeclarativeView::Status)), this, SLOT(statusChanged())); - QObject::connect(canvas->engine(), SIGNAL(quit()), QCoreApplication::instance (), SLOT(quit())); + QObject::connect(canvas->engine(), SIGNAL(quit()), this, SLOT(close())); QObject::connect(warningsWidget(), SIGNAL(opened()), this, SLOT(warningsWidgetOpened())); QObject::connect(warningsWidget(), SIGNAL(closed()), this, SLOT(warningsWidgetClosed())); @@ -664,11 +707,11 @@ LoggerWidget *QDeclarativeViewer::warningsWidget() const void QDeclarativeViewer::createMenu() { QAction *openAction = new QAction(tr("&Open..."), this); - openAction->setShortcut(QKeySequence("Ctrl+O")); + openAction->setShortcuts(QKeySequence::Open); connect(openAction, SIGNAL(triggered()), this, SLOT(openFile())); QAction *reloadAction = new QAction(tr("&Reload"), this); - reloadAction->setShortcut(QKeySequence("Ctrl+R")); + reloadAction->setShortcuts(QKeySequence::Refresh); connect(reloadAction, SIGNAL(triggered()), this, SLOT(reload())); QAction *snapshotAction = new QAction(tr("&Take Snapshot"), this); @@ -717,10 +760,16 @@ void QDeclarativeViewer::createMenu() 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->setShortcut(QKeySequence("Ctrl+Q")); + quitAction->setMenuRole(QAction::QuitRole); + quitAction->setShortcuts(QKeySequence::Quit); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); QMenuBar *menu = menuBar(); @@ -751,6 +800,7 @@ void QDeclarativeViewer::createMenu() fileMenu->addAction(openAction); fileMenu->addAction(reloadAction); fileMenu->addSeparator(); + fileMenu->addAction(closeAction); fileMenu->addAction(quitAction); #if !defined(Q_OS_SYMBIAN) @@ -927,7 +977,7 @@ void QDeclarativeViewer::openFile() { QString cur = canvas->source().toLocalFile(); if (useQmlFileBrowser) { - open("qrc:/content/Browser.qml"); + open("qrc:/browser/Browser.qml"); } else { QString fileName = QFileDialog::getOpenFileName(this, tr("Open QML file"), cur, tr("QML Files (*.qml)")); if (!fileName.isEmpty()) { diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index 68d3452..7385b14 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -105,6 +105,7 @@ public: QDeclarativeView *view() const; LoggerWidget *warningsWidget() const; + QString currentFile() const { return currentFileOrUrl; } void enableExperimentalGestures(); diff --git a/tools/qml/qmlruntime.qrc b/tools/qml/qmlruntime.qrc deleted file mode 100644 index 3a9e608..0000000 --- a/tools/qml/qmlruntime.qrc +++ /dev/null @@ -1,9 +0,0 @@ - - - content/Browser.qml - content/images/up.png - content/images/folder.png - content/images/titlebar.sci - content/images/titlebar.png - - diff --git a/tools/qml/startup/Logo.qml b/tools/qml/startup/Logo.qml new file mode 100644 index 0000000..9252223 --- /dev/null +++ b/tools/qml/startup/Logo.qml @@ -0,0 +1,138 @@ +import Qt 4.7 + +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/qml/startup/qt-back.png b/tools/qml/startup/qt-back.png new file mode 100644 index 0000000..077215f Binary files /dev/null and b/tools/qml/startup/qt-back.png differ diff --git a/tools/qml/startup/qt-blue.jpg b/tools/qml/startup/qt-blue.jpg new file mode 100644 index 0000000..b204896 Binary files /dev/null and b/tools/qml/startup/qt-blue.jpg differ diff --git a/tools/qml/startup/qt-front.png b/tools/qml/startup/qt-front.png new file mode 100644 index 0000000..dbfb43e Binary files /dev/null and b/tools/qml/startup/qt-front.png differ diff --git a/tools/qml/startup/qt-sketch.jpg b/tools/qml/startup/qt-sketch.jpg new file mode 100644 index 0000000..1ede6f0 Binary files /dev/null and b/tools/qml/startup/qt-sketch.jpg differ diff --git a/tools/qml/startup/qt-text.png b/tools/qml/startup/qt-text.png new file mode 100644 index 0000000..d44995c Binary files /dev/null and b/tools/qml/startup/qt-text.png differ diff --git a/tools/qml/startup/quick-blur.png b/tools/qml/startup/quick-blur.png new file mode 100644 index 0000000..29ec243 Binary files /dev/null and b/tools/qml/startup/quick-blur.png differ diff --git a/tools/qml/startup/quick-regular.png b/tools/qml/startup/quick-regular.png new file mode 100644 index 0000000..38321cb Binary files /dev/null and b/tools/qml/startup/quick-regular.png differ diff --git a/tools/qml/startup/shadow.png b/tools/qml/startup/shadow.png new file mode 100644 index 0000000..44f92fe Binary files /dev/null and b/tools/qml/startup/shadow.png differ diff --git a/tools/qml/startup/startup.qml b/tools/qml/startup/startup.qml new file mode 100644 index 0000000..6792150 --- /dev/null +++ b/tools/qml/startup/startup.qml @@ -0,0 +1,126 @@ +import Qt 4.7 + +Rectangle { + id: treatsApp + width: 800 + height: 480 + color: "darkgrey" + Component.onCompleted: treatsApp.state = "part1" + signal animationFinished + + Logo { + id: logo + x: 165 + y: 35 + rotation: -15 + scale: 0.6 + opacity: 0 + onAnimationFinished: treatsApp.animationFinished(); + } + + 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 + } + } + ] + + + Item { + id: quickblur + x: 800//325 + y: 344 + Image { + id: blurText + source: "quick-blur.png" + } + Image { + id: quickregular + x: -1 + y: 0 + opacity: 0 + source: "quick-regular.png" + } + Image { + id: star + x: -1 + y: 0 + opacity: 0 + source: "white-star.png" + smooth: true + NumberAnimation on rotation { + from: 0 + to: 360 + loops: NumberAnimation.Infinite + running: true + duration: 2000 + } + } + } + + 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/qml/startup/startup.qrc b/tools/qml/startup/startup.qrc new file mode 100644 index 0000000..52e6705 --- /dev/null +++ b/tools/qml/startup/startup.qrc @@ -0,0 +1,16 @@ + + + Logo.qml + qt-back.png + qt-blue.jpg + qt-front.png + qt-sketch.jpg + qt-text.png + quick-blur.png + quick-regular.png + shadow.png + startup.qml + startup.qrc + white-star.png + + diff --git a/tools/qml/startup/white-star.png b/tools/qml/startup/white-star.png new file mode 100644 index 0000000..f467c94 Binary files /dev/null and b/tools/qml/startup/white-star.png differ -- cgit v0.12