diff options
Diffstat (limited to 'examples/multimedia/video/snippets')
15 files changed, 0 insertions, 995 deletions
diff --git a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.cpp b/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.cpp deleted file mode 100644 index d611497fe..000000000 --- a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.cpp +++ /dev/null @@ -1,257 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "frequencymonitor.h" -#include <QDebug> -#include <QElapsedTimer> -#include <QString> -#include <QTime> -#include <QTimer> - -//#define VERBOSE_TRACE - -inline QDebug qtTrace() { return qDebug() << "[frequencymonitor]"; } -#ifdef VERBOSE_TRACE -inline QDebug qtVerboseTrace() { return qtTrace(); } -#else -inline QNoDebug qtVerboseTrace() { return QNoDebug(); } -#endif - -static const int DefaultSamplingInterval = 100; -static const int DefaultTraceInterval = 0; - -class FrequencyMonitorPrivate : public QObject -{ - Q_OBJECT - -public: - FrequencyMonitorPrivate(FrequencyMonitor *parent); - void calculateInstantaneousFrequency(); - -private slots: - void calculateAverageFrequency(); - void stalled(); - -public: - FrequencyMonitor *const q_ptr; - QString m_label; - bool m_active; - qreal m_instantaneousFrequency; - QElapsedTimer m_instantaneousElapsed; - QTimer *m_averageTimer; - QElapsedTimer m_averageElapsed; - int m_count; - qreal m_averageFrequency; - QTimer *m_traceTimer; - QTimer *m_stalledTimer; -}; - -FrequencyMonitorPrivate::FrequencyMonitorPrivate(FrequencyMonitor *parent) -: QObject(parent) -, q_ptr(parent) -, m_active(false) -, m_instantaneousFrequency(0) -, m_averageTimer(new QTimer(this)) -, m_count(0) -, m_averageFrequency(0) -, m_traceTimer(new QTimer(this)) -, m_stalledTimer(new QTimer(this)) -{ - m_instantaneousElapsed.start(); - connect(m_averageTimer, &QTimer::timeout, - this, &FrequencyMonitorPrivate::calculateAverageFrequency); - if (DefaultSamplingInterval) - m_averageTimer->start(DefaultSamplingInterval); - m_averageElapsed.start(); - connect(m_traceTimer, &QTimer::timeout, - q_ptr, &FrequencyMonitor::trace); - if (DefaultTraceInterval) - m_traceTimer->start(DefaultTraceInterval); - m_stalledTimer->setSingleShot(true); - connect(m_stalledTimer, &QTimer::timeout, - this, &FrequencyMonitorPrivate::stalled); -} - -void FrequencyMonitorPrivate::calculateInstantaneousFrequency() -{ - const qint64 ms = m_instantaneousElapsed.restart(); - m_instantaneousFrequency = ms ? qreal(1000) / ms : 0; - m_stalledTimer->start(3 * ms); - if (m_instantaneousFrequency) - q_ptr->setActive(true); - emit q_ptr->instantaneousFrequencyChanged(m_instantaneousFrequency); - emit q_ptr->frequencyChanged(); -} - -void FrequencyMonitorPrivate::calculateAverageFrequency() -{ - const qint64 ms = m_averageElapsed.restart(); - m_averageFrequency = qreal(m_count * 1000) / ms; - emit q_ptr->averageFrequencyChanged(m_averageFrequency); - emit q_ptr->frequencyChanged(); - m_count = 0; -} - -void FrequencyMonitorPrivate::stalled() -{ - if (m_instantaneousFrequency) { - m_instantaneousFrequency = 0; - emit q_ptr->instantaneousFrequencyChanged(m_instantaneousFrequency); - emit q_ptr->frequencyChanged(); - } -} - -FrequencyMonitor::FrequencyMonitor(QObject *parent) -: QObject(parent) -{ - d_ptr = new FrequencyMonitorPrivate(this); -} - -FrequencyMonitor::~FrequencyMonitor() -{ - -} - -QString FrequencyMonitor::label() const -{ - return d_func()->m_label; -} - -bool FrequencyMonitor::active() const -{ - return d_func()->m_active; -} - -int FrequencyMonitor::samplingInterval() const -{ - return d_ptr->m_averageTimer->isActive() ? d_ptr->m_averageTimer->interval() : 0; -} - -int FrequencyMonitor::traceInterval() const -{ - return d_ptr->m_traceTimer->isActive() ? d_ptr->m_traceTimer->interval() : 0; -} - -qreal FrequencyMonitor::instantaneousFrequency() const -{ - return d_func()->m_instantaneousFrequency; -} - -qreal FrequencyMonitor::averageFrequency() const -{ - return d_func()->m_averageFrequency; -} - -void FrequencyMonitor::notify() -{ - Q_D(FrequencyMonitor); - ++(d->m_count); - d->calculateInstantaneousFrequency(); -} - -void FrequencyMonitor::trace() -{ - Q_D(FrequencyMonitor); - const QString value = QString::fromLatin1("instant %1 average %2") - .arg(d->m_instantaneousFrequency, 0, 'f', 2) - .arg(d->m_averageFrequency, 0, 'f', 2); - if (d->m_label.isEmpty()) - qtTrace() << "FrequencyMonitor::trace" << value; - else - qtTrace() << "FrequencyMonitor::trace" << "label" << d->m_label << value; -} - -void FrequencyMonitor::setLabel(const QString &value) -{ - Q_D(FrequencyMonitor); - if (d->m_label != value) { - d->m_label = value; - emit labelChanged(d->m_label); - } -} - -void FrequencyMonitor::setActive(bool value) -{ - Q_D(FrequencyMonitor); - if (d->m_active != value) { - d->m_active = value; - emit activeChanged(d->m_active); - } -} - -void FrequencyMonitor::setSamplingInterval(int value) -{ - Q_D(FrequencyMonitor); - if (samplingInterval() != value) { - if (value) { - d->m_averageTimer->setInterval(value); - d->m_averageTimer->start(); - } else { - d->m_averageTimer->stop(); - } - emit samplingIntervalChanged(value); - } -} - -void FrequencyMonitor::setTraceInterval(int value) -{ - Q_D(FrequencyMonitor); - if (traceInterval() != value) { - if (value) { - d->m_traceTimer->setInterval(value); - d->m_traceTimer->start(); - } else { - d->m_traceTimer->stop(); - } - emit traceIntervalChanged(value); - } -} - -#include "frequencymonitor.moc" diff --git a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.h b/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.h deleted file mode 100644 index efeb78589..000000000 --- a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.h +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef FREQUENCYMONITOR_H -#define FREQUENCYMONITOR_H - -#include <QObject> -#include <QTimer> - -class FrequencyMonitorPrivate; - -/** - * Class for measuring frequency of events - * - * Occurrence of the event is notified by the client via the notify() slot. - * On a regular interval, both an instantaneous and a rolling average - * event frequency are calculated. - */ -class FrequencyMonitor : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(FrequencyMonitor) - Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged) - Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged) - Q_PROPERTY(int samplingInterval READ samplingInterval WRITE setSamplingInterval NOTIFY samplingIntervalChanged) - Q_PROPERTY(int traceInterval READ traceInterval WRITE setTraceInterval NOTIFY traceIntervalChanged) - Q_PROPERTY(qreal instantaneousFrequency READ instantaneousFrequency NOTIFY instantaneousFrequencyChanged) - Q_PROPERTY(qreal averageFrequency READ averageFrequency NOTIFY averageFrequencyChanged) - -public: - FrequencyMonitor(QObject *parent = 0); - ~FrequencyMonitor(); - - static void qmlRegisterType(); - - QString label() const; - bool active() const; - int samplingInterval() const; - int traceInterval() const; - qreal instantaneousFrequency() const; - qreal averageFrequency() const; - -signals: - void labelChanged(const QString &value); - void activeChanged(bool); - void samplingIntervalChanged(int value); - void traceIntervalChanged(int value); - void frequencyChanged(); - void instantaneousFrequencyChanged(qreal value); - void averageFrequencyChanged(qreal value); - -public slots: - Q_INVOKABLE void notify(); - Q_INVOKABLE void trace(); - void setActive(bool value); - void setLabel(const QString &value); - void setSamplingInterval(int value); - void setTraceInterval(int value); - -private: - FrequencyMonitorPrivate *d_ptr; -}; - -#endif // FREQUENCYMONITOR_H diff --git a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.pri b/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.pri deleted file mode 100644 index 3ac8a08c4..000000000 --- a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.pri +++ /dev/null @@ -1,5 +0,0 @@ -HEADERS += $$PWD/frequencymonitor.h -SOURCES += $$PWD/frequencymonitor.cpp -INCLUDEPATH += $$PWD -DEFINES += FREQUENCYMONITOR_SUPPORT - diff --git a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.cpp b/examples/multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.cpp deleted file mode 100644 index 0994ae213..000000000 --- a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "frequencymonitor.h" -#include <QtQml/qqml.h> - -void FrequencyMonitor::qmlRegisterType() -{ - ::qmlRegisterType<FrequencyMonitor>("FrequencyMonitor", 1, 0, "FrequencyMonitor"); -} diff --git a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.pri b/examples/multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.pri deleted file mode 100644 index 071b7286a..000000000 --- a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.pri +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 48e60cf1e..000000000 --- a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>qml/frequencymonitor/FrequencyItem.qml</file> - </qresource> -</RCC> diff --git a/examples/multimedia/video/snippets/frequencymonitor/qml/frequencymonitor/FrequencyItem.qml b/examples/multimedia/video/snippets/frequencymonitor/qml/frequencymonitor/FrequencyItem.qml deleted file mode 100644 index 13867eb3c..000000000 --- a/examples/multimedia/video/snippets/frequencymonitor/qml/frequencymonitor/FrequencyItem.qml +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import FrequencyMonitor 1.0 - -Rectangle { - id: root - property bool logging: true - property bool displayed: true - property bool enabled: logging || displayed - property alias active: monitor.active - property int samplingInterval: 500 - property color textColor: "yellow" - property int textSize: 20 - property alias label: monitor.label - - border.width: 1 - border.color: "yellow" - width: 5.5 * root.textSize - height: 3.0 * root.textSize - color: "black" - opacity: 0.5 - radius: 10 - visible: displayed && active - - // This should ensure that the monitor is on top of all other content - z: 999 - - function notify() { - monitor.notify() - } - - FrequencyMonitor { - id: monitor - samplingInterval: root.enabled ? root.samplingInterval : 0 - onAverageFrequencyChanged: { - if (root.logging) trace() - averageFrequencyText.text = monitor.averageFrequency.toFixed(2) - } - } - - Text { - id: labelText - anchors { - left: parent.left - top: parent.top - margins: 10 - } - color: root.textColor - font.pixelSize: 0.6 * root.textSize - text: root.label - width: root.width - 2*anchors.margins - elide: Text.ElideRight - } - - Text { - id: averageFrequencyText - anchors { - right: parent.right - bottom: parent.bottom - margins: 10 - } - color: root.textColor - font.pixelSize: root.textSize - } -} diff --git a/examples/multimedia/video/snippets/performancemonitor/performancemonitor.cpp b/examples/multimedia/video/snippets/performancemonitor/performancemonitor.cpp deleted file mode 100644 index 204eabc5a..000000000 --- a/examples/multimedia/video/snippets/performancemonitor/performancemonitor.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "performancemonitor.h" - -namespace PerformanceMonitor { - -bool State::parseArgument(const QByteArray &arg) -{ - bool result = false; - if (arg == "-log-perf") { - logging = true; - valid = true; - result = true; - } else if (arg == "-no-log-perf") { - logging = false; - valid = true; - result = true; - } else if (arg == "-show-perf") { - visible = true; - valid = true; - result = true; - } else if (arg == "-hide-perf") { - visible = false; - valid = true; - result = true; - } - return result; -} - -} // namespace PerformanceMonitor diff --git a/examples/multimedia/video/snippets/performancemonitor/performancemonitor.h b/examples/multimedia/video/snippets/performancemonitor/performancemonitor.h deleted file mode 100644 index 97b76caf3..000000000 --- a/examples/multimedia/video/snippets/performancemonitor/performancemonitor.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PERFORMANCEMONITOR_H -#define PERFORMANCEMONITOR_H - -#include <QByteArray> - -namespace PerformanceMonitor { - -struct State -{ - State() : valid(true), logging(false), visible(true) { } - State(bool l, bool v) : valid(true), logging(l), visible(v) { } - bool operator==(const State &other) const - { return logging == other.logging && visible == other.visible; } - bool operator!=(const State &other) const - { return logging != other.logging || visible != other.visible; } - - bool parseArgument(const QByteArray &arg); - - bool valid; - bool logging; - bool visible; -}; - -} // namespace PerformanceMonitor - -#endif // PERFORMANCEMONITOR_H - diff --git a/examples/multimedia/video/snippets/performancemonitor/performancemonitor.pri b/examples/multimedia/video/snippets/performancemonitor/performancemonitor.pri deleted file mode 100644 index 2df3cfb13..000000000 --- a/examples/multimedia/video/snippets/performancemonitor/performancemonitor.pri +++ /dev/null @@ -1,5 +0,0 @@ -INCLUDEPATH += $$PWD -HEADERS += $$PWD/performancemonitor.h -SOURCES += $$PWD/performancemonitor.cpp -DEFINES += PERFORMANCEMONITOR_SUPPORT - diff --git a/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.cpp b/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.cpp deleted file mode 100644 index 0783fdbd9..000000000 --- a/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "frequencymonitor.h" -#include "performancemonitor.h" - -namespace PerformanceMonitor { - - void qmlRegisterTypes() - { - FrequencyMonitor::qmlRegisterType(); - } -} diff --git a/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.h b/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.h deleted file mode 100644 index ca70657ce..000000000 --- a/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PERFORMANCEMONITORDECLARATIVE_H -#define PERFORMANCEMONITORDECLARATIVE_H - -#include "performancemonitor.h" - -namespace PerformanceMonitor { - void qmlRegisterTypes(); -} - -#endif // PERFORMANCEMONITORDECLARATIVE_H diff --git a/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.pri b/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.pri deleted file mode 100644 index 9a18e35e5..000000000 --- a/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.pri +++ /dev/null @@ -1,6 +0,0 @@ -include($$PWD/../frequencymonitor/frequencymonitordeclarative.pri) -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 deleted file mode 100644 index 9ec54a3e4..000000000 --- a/examples/multimedia/video/snippets/performancemonitor/performancemonitordeclarative.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>qml/performancemonitor/PerformanceItem.qml</file> - </qresource> -</RCC> diff --git a/examples/multimedia/video/snippets/performancemonitor/qml/performancemonitor/PerformanceItem.qml b/examples/multimedia/video/snippets/performancemonitor/qml/performancemonitor/PerformanceItem.qml deleted file mode 100644 index 6f5d3d7d3..000000000 --- a/examples/multimedia/video/snippets/performancemonitor/qml/performancemonitor/PerformanceItem.qml +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Rectangle { - id: root - property bool logging: true - property bool displayed: true - property bool videoActive - property int margins: 5 - property bool enabled: true - - color: "transparent" - - // This should ensure that the monitor is on top of all other content - z: 999 - - Column { - id: column - anchors { - fill: root - margins: 10 - } - spacing: 10 - } - - QtObject { - id: d - property Item qmlFrameRateItem: null - property Item videoFrameRateItem: null - } - - Connections { - id: videoFrameRateActiveConnections - ignoreUnknownSignals: true - onActiveChanged: root.videoActive = videoFrameRateActiveConnections.target.active - } - - states: [ - State { - name: "hidden" - PropertyChanges { - target: root - opacity: 0 - } - } - ] - - transitions: [ - Transition { - from: "*" - to: "*" - NumberAnimation { - properties: "opacity" - easing.type: Easing.OutQuart - duration: 500 - } - } - ] - - state: enabled ? "baseState" : "hidden" - - function createQmlFrameRateItem() { - var component = Qt.createComponent("../frequencymonitor/FrequencyItem.qml") - if (component.status == Component.Ready) - d.qmlFrameRateItem = component.createObject(column, { label: "QML frame rate", - displayed: root.displayed, - logging: root.logging - }) - } - - function createVideoFrameRateItem() { - var component = Qt.createComponent("../frequencymonitor/FrequencyItem.qml") - if (component.status == Component.Ready) - d.videoFrameRateItem = component.createObject(column, { label: "Video frame rate", - displayed: root.displayed, - logging: root.logging - }) - videoFrameRateActiveConnections.target = d.videoFrameRateItem - } - - - function init() { - createQmlFrameRateItem() - createVideoFrameRateItem() - } - - function videoFramePainted() { - if (d.videoFrameRateItem) - d.videoFrameRateItem.notify() - } - - function qmlFramePainted() { - if (d.qmlFrameRateItem) - d.qmlFrameRateItem.notify() - } - - onVideoActiveChanged: { - if (d.videoFrameRateItem) - d.videoFrameRateItem.active = root.videoActive - } -} |