From d13a7a1f8949c4fab37783064cfba27a49757608 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 14 Dec 2012 14:14:01 +0100 Subject: Examples: Remove qmlapplicationviewer template. Fix shadow-builds for qmlviewer examples by using qrc files instead. Task-number: QTBUG-28614 Change-Id: Iec993f95166ffd09e8edff552ceca5bc4112d293 Reviewed-by: Oswald Buddenhagen Reviewed-by: hjk --- examples/multimedia/video/qmlvideo/main.cpp | 10 +- .../qmlapplicationviewer/qmlapplicationviewer.cpp | 129 --------------------- .../qmlapplicationviewer/qmlapplicationviewer.h | 70 ----------- .../qmlapplicationviewer/qmlapplicationviewer.pri | 5 - examples/multimedia/video/qmlvideo/qmlvideo.pro | 4 +- examples/multimedia/video/qmlvideo/qmlvideo.qrc | 47 +++++++- examples/multimedia/video/qmlvideofx/main.cpp | 8 +- .../multimedia/video/qmlvideofx/qmlvideofx.pro | 4 +- .../multimedia/video/qmlvideofx/qmlvideofx.qrc | 52 +++++++-- .../frequencymonitordeclarative.pri | 2 + .../frequencymonitordeclarative.qrc | 5 + .../performancemonitordeclarative.pri | 1 + .../performancemonitordeclarative.qrc | 5 + 13 files changed, 118 insertions(+), 224 deletions(-) delete mode 100644 examples/multimedia/video/qmlvideo/qmlapplicationviewer/qmlapplicationviewer.cpp delete mode 100644 examples/multimedia/video/qmlvideo/qmlapplicationviewer/qmlapplicationviewer.h delete mode 100644 examples/multimedia/video/qmlvideo/qmlapplicationviewer/qmlapplicationviewer.pri create mode 100644 examples/multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.qrc create mode 100644 examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.qrc diff --git a/examples/multimedia/video/qmlvideo/main.cpp b/examples/multimedia/video/qmlvideo/main.cpp index 86b91482b..8230e9441 100644 --- a/examples/multimedia/video/qmlvideo/main.cpp +++ b/examples/multimedia/video/qmlvideo/main.cpp @@ -43,9 +43,10 @@ #include #include #include +#include #include #include -#include "qmlapplicationviewer.h" +#include #include "trace.h" #ifdef PERFORMANCEMONITOR_SUPPORT @@ -108,9 +109,10 @@ int main(int argc, char *argv[]) url2 = QUrl::fromLocalFile(source2); } - QmlApplicationViewer viewer; + QQuickView viewer; + viewer.setSource(QUrl("qrc:///qml/qmlvideo/main.qml")); + QObject::connect(viewer.engine(), SIGNAL(quit()), &viewer, SLOT(close())); - viewer.setMainQmlFile(QLatin1String("qml/qmlvideo/main.qml")); QQuickItem *rootObject = viewer.rootObject(); rootObject->setProperty("source1", url1); rootObject->setProperty("source2", url2); @@ -133,7 +135,7 @@ int main(int argc, char *argv[]) QMetaObject::invokeMethod(rootObject, "init"); - viewer.showExpanded(); + viewer.show(); return app.exec(); } diff --git a/examples/multimedia/video/qmlvideo/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/multimedia/video/qmlvideo/qmlapplicationviewer/qmlapplicationviewer.cpp deleted file mode 100644 index 2ffc0b219..000000000 --- a/examples/multimedia/video/qmlvideo/qmlapplicationviewer/qmlapplicationviewer.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** 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, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlapplicationviewer.h" - -#include -#include -#include -#include -#include -#include - -class QmlApplicationViewerPrivate -{ - QmlApplicationViewerPrivate(QQuickView *view_) : view(view_) {} - - QString mainQmlFile; - QQuickView *view; - friend class QmlApplicationViewer; - QString adjustPath(const QString &path); -}; - -QString QmlApplicationViewerPrivate::adjustPath(const QString &path) -{ -#ifdef Q_OS_UNIX -#ifdef Q_OS_MAC - if (!QDir::isAbsolutePath(path)) - return QCoreApplication::applicationDirPath() - + QLatin1String("/../Resources/") + path; -#else - QString pathInInstallDir; - const QString applicationDirPath = QCoreApplication::applicationDirPath(); - pathInInstallDir = QString::fromLatin1("%1/../%2").arg(applicationDirPath, path); - - if (QFileInfo(pathInInstallDir).exists()) - return pathInInstallDir; -#endif -#endif - return path; -} - -QmlApplicationViewer::QmlApplicationViewer(QWindow *parent) - : QQuickView(parent) - , d(new QmlApplicationViewerPrivate(this)) -{ - connect(engine(), SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit())); - setResizeMode(QQuickView::SizeRootObjectToView); -} - -QmlApplicationViewer::QmlApplicationViewer(QQuickView *view, QWindow *parent) - : QQuickView(parent) - , d(new QmlApplicationViewerPrivate(view)) -{ - connect(view->engine(), SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit())); - view->setResizeMode(QQuickView::SizeRootObjectToView); -} - -QmlApplicationViewer::~QmlApplicationViewer() -{ - delete d; -} - -QmlApplicationViewer *QmlApplicationViewer::create() -{ - return new QmlApplicationViewer(); -} - -void QmlApplicationViewer::setMainQmlFile(const QString &file) -{ - d->mainQmlFile = d->adjustPath(file); - d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile)); -} - -void QmlApplicationViewer::addImportPath(const QString &path) -{ - d->view->engine()->addImportPath(d->adjustPath(path)); -} - -void QmlApplicationViewer::showExpanded() -{ -#if defined(Q_WS_SIMULATOR) - d->view->showFullScreen(); -#else - d->view->show(); -#endif -} - -QGuiApplication *createApplication(int &argc, char **argv) -{ - return new QGuiApplication(argc, argv); -} diff --git a/examples/multimedia/video/qmlvideo/qmlapplicationviewer/qmlapplicationviewer.h b/examples/multimedia/video/qmlvideo/qmlapplicationviewer/qmlapplicationviewer.h deleted file mode 100644 index a4eabdba8..000000000 --- a/examples/multimedia/video/qmlvideo/qmlapplicationviewer/qmlapplicationviewer.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** 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, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLAPPLICATIONVIEWER_H -#define QMLAPPLICATIONVIEWER_H - -#include -#include - -class QmlApplicationViewer : public QQuickView -{ - Q_OBJECT - -public: - explicit QmlApplicationViewer(QWindow *parent = 0); - virtual ~QmlApplicationViewer(); - - static QmlApplicationViewer *create(); - - void setMainQmlFile(const QString &file); - void addImportPath(const QString &path); - - void showExpanded(); - -private: - explicit QmlApplicationViewer(QQuickView *view, QWindow *parent); - class QmlApplicationViewerPrivate *d; -}; - -QGuiApplication *createApplication(int &argc, char **argv); - -#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/multimedia/video/qmlvideo/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/multimedia/video/qmlvideo/qmlapplicationviewer/qmlapplicationviewer.pri deleted file mode 100644 index 75d66c36b..000000000 --- a/examples/multimedia/video/qmlvideo/qmlapplicationviewer/qmlapplicationviewer.pri +++ /dev/null @@ -1,5 +0,0 @@ -QT += qml quick - -SOURCES += $$PWD/qmlapplicationviewer.cpp -HEADERS += $$PWD/qmlapplicationviewer.h -INCLUDEPATH += $$PWD diff --git a/examples/multimedia/video/qmlvideo/qmlvideo.pro b/examples/multimedia/video/qmlvideo/qmlvideo.pro index 78c6f0540..3ea513d3a 100644 --- a/examples/multimedia/video/qmlvideo/qmlvideo.pro +++ b/examples/multimedia/video/qmlvideo/qmlvideo.pro @@ -1,6 +1,8 @@ TEMPLATE = app TARGET = qmlvideo +QT += quick + LOCAL_SOURCES = main.cpp LOCAL_HEADERS = trace.h @@ -11,8 +13,6 @@ RESOURCES += qmlvideo.qrc SNIPPETS_PATH = ../snippets include($$SNIPPETS_PATH/performancemonitor/performancemonitordeclarative.pri) -include(qmlapplicationviewer/qmlapplicationviewer.pri) - target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/video/qmlvideo INSTALLS += target diff --git a/examples/multimedia/video/qmlvideo/qmlvideo.qrc b/examples/multimedia/video/qmlvideo/qmlvideo.qrc index 4896b336f..5bf2df8af 100644 --- a/examples/multimedia/video/qmlvideo/qmlvideo.qrc +++ b/examples/multimedia/video/qmlvideo/qmlvideo.qrc @@ -1,5 +1,5 @@ - + images/leaves.jpg images/close.png images/folder.png @@ -8,5 +8,50 @@ images/up.png images/progress_handle.svg images/progress_handle_pressed.svg + qml/qmlvideo/Button.qml + qml/qmlvideo/CameraBasic.qml + qml/qmlvideo/CameraDrag.qml + qml/qmlvideo/CameraDummy.qml + qml/qmlvideo/CameraFullScreen.qml + qml/qmlvideo/CameraFullScreenInverted.qml + qml/qmlvideo/CameraItem.qml + qml/qmlvideo/CameraMove.qml + qml/qmlvideo/CameraOverlay.qml + qml/qmlvideo/CameraResize.qml + qml/qmlvideo/CameraRotate.qml + qml/qmlvideo/CameraSpin.qml + qml/qmlvideo/Content.qml + qml/qmlvideo/DisableScreenSaver.qml + qml/qmlvideo/ErrorDialog.qml + qml/qmlvideo/FileBrowser.qml + qml/qmlvideo/main.qml + qml/qmlvideo/Scene.qml + qml/qmlvideo/SceneBasic.qml + qml/qmlvideo/SceneDrag.qml + qml/qmlvideo/SceneFullScreen.qml + qml/qmlvideo/SceneFullScreenInverted.qml + qml/qmlvideo/SceneMove.qml + qml/qmlvideo/SceneMulti.qml + qml/qmlvideo/SceneOverlay.qml + qml/qmlvideo/SceneResize.qml + qml/qmlvideo/SceneRotate.qml + qml/qmlvideo/SceneSelectionPanel.qml + qml/qmlvideo/SceneSpin.qml + qml/qmlvideo/SeekControl.qml + qml/qmlvideo/VideoBasic.qml + qml/qmlvideo/VideoDrag.qml + qml/qmlvideo/VideoDummy.qml + qml/qmlvideo/VideoFillMode.qml + qml/qmlvideo/VideoFullScreen.qml + qml/qmlvideo/VideoFullScreenInverted.qml + qml/qmlvideo/VideoItem.qml + qml/qmlvideo/VideoMetadata.qml + qml/qmlvideo/VideoMove.qml + qml/qmlvideo/VideoOverlay.qml + qml/qmlvideo/VideoPlaybackRate.qml + qml/qmlvideo/VideoResize.qml + qml/qmlvideo/VideoRotate.qml + qml/qmlvideo/VideoSeek.qml + qml/qmlvideo/VideoSpin.qml diff --git a/examples/multimedia/video/qmlvideofx/main.cpp b/examples/multimedia/video/qmlvideofx/main.cpp index 92e476a1e..9f47a9c17 100644 --- a/examples/multimedia/video/qmlvideofx/main.cpp +++ b/examples/multimedia/video/qmlvideofx/main.cpp @@ -44,8 +44,8 @@ #include #include #include +#include #include "filereader.h" -#include "qmlapplicationviewer.h" #include "trace.h" #ifdef SMALL_SCREEN_LAYOUT @@ -97,9 +97,9 @@ int main(int argc, char *argv[]) } } - QmlApplicationViewer viewer; + QQuickView viewer; - viewer.setMainQmlFile(QLatin1String("qml/qmlvideofx/") + MainQmlFile); + viewer.setSource(QLatin1String("qrc:///qml/qmlvideofx/") + MainQmlFile); QQuickItem *rootObject = viewer.rootObject(); rootObject->setProperty("fileName", fileName); viewer.rootObject()->setProperty("volume", volume); @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) #ifdef SMALL_SCREEN_PHYSICAL viewer.showFullScreen(); #else - viewer.showExpanded(); + viewer.show(); #endif // Delay invocation of init until the event loop has started, to work around diff --git a/examples/multimedia/video/qmlvideofx/qmlvideofx.pro b/examples/multimedia/video/qmlvideofx/qmlvideofx.pro index 7779565f5..629c0bdce 100644 --- a/examples/multimedia/video/qmlvideofx/qmlvideofx.pro +++ b/examples/multimedia/video/qmlvideofx/qmlvideofx.pro @@ -1,6 +1,8 @@ TEMPLATE = app TARGET = qmlvideofx +QT += quick + LOCAL_SOURCES = filereader.cpp main.cpp LOCAL_HEADERS = filereader.h trace.h @@ -17,7 +19,5 @@ maemo6: { DEFINES += SMALL_SCREEN_PHYSICAL } -include(qmlapplicationviewer/qmlapplicationviewer.pri) - target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/video/qmlvideofx INSTALLS += target diff --git a/examples/multimedia/video/qmlvideofx/qmlvideofx.qrc b/examples/multimedia/video/qmlvideofx/qmlvideofx.qrc index 6ca4ef54b..0b39099a1 100644 --- a/examples/multimedia/video/qmlvideofx/qmlvideofx.qrc +++ b/examples/multimedia/video/qmlvideofx/qmlvideofx.qrc @@ -1,10 +1,48 @@ - - images/close.png - images/folder.png - images/titlebar.png - images/titlebar.sci - images/up.png - images/qt-logo.png + + images/close.png + images/folder.png + images/titlebar.png + images/titlebar.sci + images/up.png + images/qt-logo.png + qml/qmlvideofx/Button.qml + qml/qmlvideofx/Content.qml + qml/qmlvideofx/ContentCamera.qml + qml/qmlvideofx/ContentImage.qml + qml/qmlvideofx/ContentVideo.qml + qml/qmlvideofx/DisableScreenSaver.qml + qml/qmlvideofx/Divider.qml + qml/qmlvideofx/Effect.qml + qml/qmlvideofx/EffectBillboard.qml + qml/qmlvideofx/EffectBlackAndWhite.qml + qml/qmlvideofx/EffectEmboss.qml + qml/qmlvideofx/EffectGaussianBlur.qml + qml/qmlvideofx/EffectGlow.qml + qml/qmlvideofx/EffectIsolate.qml + qml/qmlvideofx/EffectMagnify.qml + qml/qmlvideofx/EffectPageCurl.qml + qml/qmlvideofx/EffectPassThrough.qml + qml/qmlvideofx/EffectPixelate.qml + qml/qmlvideofx/EffectPosterize.qml + qml/qmlvideofx/EffectRipple.qml + qml/qmlvideofx/EffectSelectionPanel.qml + qml/qmlvideofx/EffectSepia.qml + qml/qmlvideofx/EffectSharpen.qml + qml/qmlvideofx/EffectShockwave.qml + qml/qmlvideofx/EffectSobelEdgeDetection1.qml + qml/qmlvideofx/EffectSobelEdgeDetection2.qml + qml/qmlvideofx/EffectTiltShift.qml + qml/qmlvideofx/EffectToon.qml + qml/qmlvideofx/EffectVignette.qml + qml/qmlvideofx/EffectWarhol.qml + qml/qmlvideofx/EffectWobble.qml + qml/qmlvideofx/FileBrowser.qml + qml/qmlvideofx/FileOpen.qml + qml/qmlvideofx/HintedMouseArea.qml + qml/qmlvideofx/main-largescreen.qml + qml/qmlvideofx/main-smallscreen.qml + qml/qmlvideofx/ParameterPanel.qml + qml/qmlvideofx/Slider.qml diff --git a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.pri b/examples/multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.pri index 90a111cd1..071b7286a 100644 --- a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.pri +++ b/examples/multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.pri @@ -1,3 +1,5 @@ include($$PWD/frequencymonitor.pri) QT += qml + SOURCES += $$PWD/frequencymonitordeclarative.cpp +RESOURCES += $$PWD/frequencymonitordeclarative.qrc diff --git a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.qrc b/examples/multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.qrc new file mode 100644 index 000000000..48e60cf1e --- /dev/null +++ b/examples/multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.qrc @@ -0,0 +1,5 @@ + + + qml/frequencymonitor/FrequencyItem.qml + + diff --git a/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.pri b/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.pri index cf32c4ed2..9a18e35e5 100644 --- a/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.pri +++ b/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.pri @@ -3,3 +3,4 @@ include($$PWD/performancemonitor.pri) HEADERS += $$PWD/performancemonitordeclarative.h SOURCES += $$PWD/performancemonitordeclarative.cpp +RESOURCES += $$PWD/performancemonitordeclarative.qrc diff --git a/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.qrc b/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.qrc new file mode 100644 index 000000000..9ec54a3e4 --- /dev/null +++ b/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.qrc @@ -0,0 +1,5 @@ + + + qml/performancemonitor/PerformanceItem.qml + + -- cgit v1.2.1