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 <oswald.buddenhagen@digia.com> Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
committed by
The Qt Project
parent
0f2fc9ffd9
commit
d13a7a1f89
@@ -43,9 +43,10 @@
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtQml/QQmlContext>
|
||||
#include <QtQml/QQmlEngine>
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtQuick/QQuickItem>
|
||||
#include "qmlapplicationviewer.h"
|
||||
#include <QtQuick/QQuickView>
|
||||
#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();
|
||||
}
|
||||
|
||||
@@ -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 <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtQml/QQmlComponent>
|
||||
#include <QtQml/QQmlEngine>
|
||||
#include <QtQml/QQmlContext>
|
||||
#include <QtGui/QGuiApplication>
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -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 <QtQuick/QQuickView>
|
||||
#include <QtGui/QGuiApplication>
|
||||
|
||||
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
|
||||
@@ -1,5 +0,0 @@
|
||||
QT += qml quick
|
||||
|
||||
SOURCES += $$PWD/qmlapplicationviewer.cpp
|
||||
HEADERS += $$PWD/qmlapplicationviewer.h
|
||||
INCLUDEPATH += $$PWD
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/images">
|
||||
<qresource prefix="/">
|
||||
<file alias="leaves.jpg">images/leaves.jpg</file>
|
||||
<file alias="close.png">images/close.png</file>
|
||||
<file alias="folder.png">images/folder.png</file>
|
||||
@@ -8,5 +8,50 @@
|
||||
<file alias="up.png">images/up.png</file>
|
||||
<file alias="progress_handle.svg">images/progress_handle.svg</file>
|
||||
<file alias="progress_handle_pressed.svg">images/progress_handle_pressed.svg</file>
|
||||
<file>qml/qmlvideo/Button.qml</file>
|
||||
<file>qml/qmlvideo/CameraBasic.qml</file>
|
||||
<file>qml/qmlvideo/CameraDrag.qml</file>
|
||||
<file>qml/qmlvideo/CameraDummy.qml</file>
|
||||
<file>qml/qmlvideo/CameraFullScreen.qml</file>
|
||||
<file>qml/qmlvideo/CameraFullScreenInverted.qml</file>
|
||||
<file>qml/qmlvideo/CameraItem.qml</file>
|
||||
<file>qml/qmlvideo/CameraMove.qml</file>
|
||||
<file>qml/qmlvideo/CameraOverlay.qml</file>
|
||||
<file>qml/qmlvideo/CameraResize.qml</file>
|
||||
<file>qml/qmlvideo/CameraRotate.qml</file>
|
||||
<file>qml/qmlvideo/CameraSpin.qml</file>
|
||||
<file>qml/qmlvideo/Content.qml</file>
|
||||
<file>qml/qmlvideo/DisableScreenSaver.qml</file>
|
||||
<file>qml/qmlvideo/ErrorDialog.qml</file>
|
||||
<file>qml/qmlvideo/FileBrowser.qml</file>
|
||||
<file>qml/qmlvideo/main.qml</file>
|
||||
<file>qml/qmlvideo/Scene.qml</file>
|
||||
<file>qml/qmlvideo/SceneBasic.qml</file>
|
||||
<file>qml/qmlvideo/SceneDrag.qml</file>
|
||||
<file>qml/qmlvideo/SceneFullScreen.qml</file>
|
||||
<file>qml/qmlvideo/SceneFullScreenInverted.qml</file>
|
||||
<file>qml/qmlvideo/SceneMove.qml</file>
|
||||
<file>qml/qmlvideo/SceneMulti.qml</file>
|
||||
<file>qml/qmlvideo/SceneOverlay.qml</file>
|
||||
<file>qml/qmlvideo/SceneResize.qml</file>
|
||||
<file>qml/qmlvideo/SceneRotate.qml</file>
|
||||
<file>qml/qmlvideo/SceneSelectionPanel.qml</file>
|
||||
<file>qml/qmlvideo/SceneSpin.qml</file>
|
||||
<file>qml/qmlvideo/SeekControl.qml</file>
|
||||
<file>qml/qmlvideo/VideoBasic.qml</file>
|
||||
<file>qml/qmlvideo/VideoDrag.qml</file>
|
||||
<file>qml/qmlvideo/VideoDummy.qml</file>
|
||||
<file>qml/qmlvideo/VideoFillMode.qml</file>
|
||||
<file>qml/qmlvideo/VideoFullScreen.qml</file>
|
||||
<file>qml/qmlvideo/VideoFullScreenInverted.qml</file>
|
||||
<file>qml/qmlvideo/VideoItem.qml</file>
|
||||
<file>qml/qmlvideo/VideoMetadata.qml</file>
|
||||
<file>qml/qmlvideo/VideoMove.qml</file>
|
||||
<file>qml/qmlvideo/VideoOverlay.qml</file>
|
||||
<file>qml/qmlvideo/VideoPlaybackRate.qml</file>
|
||||
<file>qml/qmlvideo/VideoResize.qml</file>
|
||||
<file>qml/qmlvideo/VideoRotate.qml</file>
|
||||
<file>qml/qmlvideo/VideoSeek.qml</file>
|
||||
<file>qml/qmlvideo/VideoSpin.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
#include <QtQml/QQmlContext>
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtQuick/QQuickItem>
|
||||
#include <QtQuick/QQuickView>
|
||||
#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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,10 +1,48 @@
|
||||
<RCC>
|
||||
<qresource prefix="/images">
|
||||
<file alias="close.png">images/close.png</file>
|
||||
<file alias="folder.png">images/folder.png</file>
|
||||
<file alias="titlebar.png">images/titlebar.png</file>
|
||||
<file alias="titlebar.sci">images/titlebar.sci</file>
|
||||
<file alias="up.png">images/up.png</file>
|
||||
<file alias="qt-logo.png">images/qt-logo.png</file>
|
||||
<qresource prefix="/">
|
||||
<file>images/close.png</file>
|
||||
<file>images/folder.png</file>
|
||||
<file>images/titlebar.png</file>
|
||||
<file>images/titlebar.sci</file>
|
||||
<file>images/up.png</file>
|
||||
<file>images/qt-logo.png</file>
|
||||
<file>qml/qmlvideofx/Button.qml</file>
|
||||
<file>qml/qmlvideofx/Content.qml</file>
|
||||
<file>qml/qmlvideofx/ContentCamera.qml</file>
|
||||
<file>qml/qmlvideofx/ContentImage.qml</file>
|
||||
<file>qml/qmlvideofx/ContentVideo.qml</file>
|
||||
<file>qml/qmlvideofx/DisableScreenSaver.qml</file>
|
||||
<file>qml/qmlvideofx/Divider.qml</file>
|
||||
<file>qml/qmlvideofx/Effect.qml</file>
|
||||
<file>qml/qmlvideofx/EffectBillboard.qml</file>
|
||||
<file>qml/qmlvideofx/EffectBlackAndWhite.qml</file>
|
||||
<file>qml/qmlvideofx/EffectEmboss.qml</file>
|
||||
<file>qml/qmlvideofx/EffectGaussianBlur.qml</file>
|
||||
<file>qml/qmlvideofx/EffectGlow.qml</file>
|
||||
<file>qml/qmlvideofx/EffectIsolate.qml</file>
|
||||
<file>qml/qmlvideofx/EffectMagnify.qml</file>
|
||||
<file>qml/qmlvideofx/EffectPageCurl.qml</file>
|
||||
<file>qml/qmlvideofx/EffectPassThrough.qml</file>
|
||||
<file>qml/qmlvideofx/EffectPixelate.qml</file>
|
||||
<file>qml/qmlvideofx/EffectPosterize.qml</file>
|
||||
<file>qml/qmlvideofx/EffectRipple.qml</file>
|
||||
<file>qml/qmlvideofx/EffectSelectionPanel.qml</file>
|
||||
<file>qml/qmlvideofx/EffectSepia.qml</file>
|
||||
<file>qml/qmlvideofx/EffectSharpen.qml</file>
|
||||
<file>qml/qmlvideofx/EffectShockwave.qml</file>
|
||||
<file>qml/qmlvideofx/EffectSobelEdgeDetection1.qml</file>
|
||||
<file>qml/qmlvideofx/EffectSobelEdgeDetection2.qml</file>
|
||||
<file>qml/qmlvideofx/EffectTiltShift.qml</file>
|
||||
<file>qml/qmlvideofx/EffectToon.qml</file>
|
||||
<file>qml/qmlvideofx/EffectVignette.qml</file>
|
||||
<file>qml/qmlvideofx/EffectWarhol.qml</file>
|
||||
<file>qml/qmlvideofx/EffectWobble.qml</file>
|
||||
<file>qml/qmlvideofx/FileBrowser.qml</file>
|
||||
<file>qml/qmlvideofx/FileOpen.qml</file>
|
||||
<file>qml/qmlvideofx/HintedMouseArea.qml</file>
|
||||
<file>qml/qmlvideofx/main-largescreen.qml</file>
|
||||
<file>qml/qmlvideofx/main-smallscreen.qml</file>
|
||||
<file>qml/qmlvideofx/ParameterPanel.qml</file>
|
||||
<file>qml/qmlvideofx/Slider.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
include($$PWD/frequencymonitor.pri)
|
||||
QT += qml
|
||||
|
||||
SOURCES += $$PWD/frequencymonitordeclarative.cpp
|
||||
RESOURCES += $$PWD/frequencymonitordeclarative.qrc
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>qml/frequencymonitor/FrequencyItem.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -3,3 +3,4 @@ include($$PWD/performancemonitor.pri)
|
||||
|
||||
HEADERS += $$PWD/performancemonitordeclarative.h
|
||||
SOURCES += $$PWD/performancemonitordeclarative.cpp
|
||||
RESOURCES += $$PWD/performancemonitordeclarative.qrc
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>qml/performancemonitor/PerformanceItem.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
Reference in New Issue
Block a user