diff --git a/examples/multimedia/video/qmlvideo/main.cpp b/examples/multimedia/video/qmlvideo/main.cpp index 8230e944..ac26c983 100644 --- a/examples/multimedia/video/qmlvideo/main.cpp +++ b/examples/multimedia/video/qmlvideo/main.cpp @@ -69,8 +69,8 @@ int main(int argc, char *argv[]) QStringList args = app.arguments(); PerformanceMonitor::State performanceMonitorState; bool sourceIsUrl = false; - for (int i=1; i -#include -#include -#include -#include -QString 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; -} +#include +#include +#include +#include +#include QString FileReader::readFile(const QString &fileName) { qtTrace() << "FileReader::readFile" << "fileName" << fileName; QString content; - QFile file(adjustPath(fileName)); + QFile file(fileName); if (file.open(QIODevice::ReadOnly)) { QTextStream stream(&file); content = stream.readAll(); diff --git a/examples/multimedia/video/qmlvideofx/filereader.h b/examples/multimedia/video/qmlvideofx/filereader.h index 44393b1c..443a2a2f 100644 --- a/examples/multimedia/video/qmlvideofx/filereader.h +++ b/examples/multimedia/video/qmlvideofx/filereader.h @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include +#include class FileReader : public QObject { diff --git a/examples/multimedia/video/qmlvideofx/main.cpp b/examples/multimedia/video/qmlvideofx/main.cpp index 9f47a9c1..056c274e 100644 --- a/examples/multimedia/video/qmlvideofx/main.cpp +++ b/examples/multimedia/video/qmlvideofx/main.cpp @@ -72,17 +72,17 @@ int main(int argc, char *argv[]) #ifdef PERFORMANCEMONITOR_SUPPORT PerformanceMonitor::State performanceMonitorState; #endif - for (int i=1; iqml/qmlvideofx/main-smallscreen.qml qml/qmlvideofx/ParameterPanel.qml qml/qmlvideofx/Slider.qml + shaders/billboard.fsh + shaders/blackandwhite.fsh + shaders/emboss.fsh + shaders/gaussianblur_h.fsh + shaders/gaussianblur_v.fsh + shaders/glow.fsh + shaders/isolate.fsh + shaders/magnify.fsh + shaders/pagecurl.fsh + shaders/pixelate.fsh + shaders/posterize.fsh + shaders/ripple.fsh + shaders/selectionpanel.fsh + shaders/sepia.fsh + shaders/sharpen.fsh + shaders/shockwave.fsh + shaders/sobeledgedetection1.fsh + shaders/sobeledgedetection2.fsh + shaders/tiltshift.fsh + shaders/toon.fsh + shaders/vignette.fsh + shaders/warhol.fsh + shaders/wobble.fsh diff --git a/examples/multimedia/video/qmlvideofx/trace.h b/examples/multimedia/video/qmlvideofx/trace.h index 73095f59..c5332d5d 100644 --- a/examples/multimedia/video/qmlvideofx/trace.h +++ b/examples/multimedia/video/qmlvideofx/trace.h @@ -42,7 +42,7 @@ #ifndef TRACE_H #define TRACE_H -#include +#include #define ENABLE_TRACE //#define VERBOSE_TRACE @@ -53,7 +53,7 @@ class NullDebug { public: template - NullDebug& operator<<(const T&) { return *this; } + NullDebug &operator<<(const T &) { return *this; } }; inline NullDebug nullDebug() { return NullDebug(); } @@ -68,18 +68,12 @@ struct PtrWrapper } // namespace Trace template -inline QDebug& operator<<(QDebug &debug, const Trace::PtrWrapper &wrapper) +inline QDebug &operator<<(QDebug &debug, const Trace::PtrWrapper &wrapper) { debug.nospace() << "[" << (void*)wrapper.m_ptr << "]"; return debug.space(); } -template -inline const void *qtVoidPtr(const T *ptr) -{ return static_cast(ptr); } - -#define qtThisPtr() qtVoidPtr(this) - #ifdef ENABLE_TRACE inline QDebug qtTrace() { return qDebug() << "[qmlvideofx]"; } # ifdef VERBOSE_TRACE diff --git a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.cpp b/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.cpp index 1d44f129..568bbc79 100644 --- a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.cpp +++ b/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.cpp @@ -40,11 +40,11 @@ ****************************************************************************/ #include "frequencymonitor.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include //#define VERBOSE_TRACE @@ -61,6 +61,7 @@ static const int DefaultTraceInterval = 0; class FrequencyMonitorPrivate : public QObject { Q_OBJECT + public: FrequencyMonitorPrivate(FrequencyMonitor *parent); void calculateInstantaneousFrequency(); @@ -116,16 +117,16 @@ void FrequencyMonitorPrivate::calculateInstantaneousFrequency() m_stalledTimer->start(3 * ms); if (m_instantaneousFrequency) q_ptr->setActive(true); - q_ptr->emit instantaneousFrequencyChanged(m_instantaneousFrequency); - q_ptr->emit frequencyChanged(); + 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; - q_ptr->emit averageFrequencyChanged(m_averageFrequency); - q_ptr->emit frequencyChanged(); + emit q_ptr->averageFrequencyChanged(m_averageFrequency); + emit q_ptr->frequencyChanged(); m_count = 0; } @@ -134,14 +135,13 @@ void FrequencyMonitorPrivate::stalled() if (m_instantaneousFrequency) { qtVerboseTrace() << "FrequencyMonitor::stalled"; m_instantaneousFrequency = 0; - q_ptr->emit instantaneousFrequencyChanged(m_instantaneousFrequency); - q_ptr->emit frequencyChanged(); + emit q_ptr->instantaneousFrequencyChanged(m_instantaneousFrequency); + emit q_ptr->frequencyChanged(); } } FrequencyMonitor::FrequencyMonitor(QObject *parent) : QObject(parent) -, d_ptr(0) { d_ptr = new FrequencyMonitorPrivate(this); qtTrace() << "FrequencyMonitor::FrequencyMonitor"; @@ -152,7 +152,7 @@ FrequencyMonitor::~FrequencyMonitor() } -const QString &FrequencyMonitor::label() const +QString FrequencyMonitor::label() const { return d_func()->m_label; } diff --git a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.h b/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.h index 1efd8b3a..f34646f9 100644 --- a/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.h +++ b/examples/multimedia/video/snippets/frequencymonitor/frequencymonitor.h @@ -42,8 +42,8 @@ #ifndef FREQUENCYMONITOR_H #define FREQUENCYMONITOR_H -#include -#include +#include +#include class FrequencyMonitorPrivate; @@ -64,13 +64,14 @@ class FrequencyMonitor : public QObject 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(); - const QString &label() const; + QString label() const; bool active() const; int samplingInterval() const; int traceInterval() const; diff --git a/examples/multimedia/video/snippets/performancemonitor/performancemonitor.cpp b/examples/multimedia/video/snippets/performancemonitor/performancemonitor.cpp index 9a7e060b..07c83485 100644 --- a/examples/multimedia/video/snippets/performancemonitor/performancemonitor.cpp +++ b/examples/multimedia/video/snippets/performancemonitor/performancemonitor.cpp @@ -43,27 +43,27 @@ namespace PerformanceMonitor { - bool parseArgument(const QString &arg, State &state) - { - bool result = false; - if ("-log-perf" == arg) { - state.logging = true; - state.valid = true; - result = true; - } else if ("-no-log-perf" == arg) { - state.logging = false; - state.valid = true; - result = true; - } else if ("-show-perf" == arg) { - state.visible = true; - state.valid = true; - result = true; - } else if ("-hide-perf" == arg) { - state.visible = false; - state.valid = true; - result = true; - } - return result; +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 index d87d71ea..f1a443e0 100644 --- a/examples/multimedia/video/snippets/performancemonitor/performancemonitor.h +++ b/examples/multimedia/video/snippets/performancemonitor/performancemonitor.h @@ -42,24 +42,27 @@ #ifndef PERFORMANCEMONITOR_H #define PERFORMANCEMONITOR_H -#include +#include namespace PerformanceMonitor { - struct State { - bool valid; - bool logging; - bool visible; - 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; } - }; +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 QString &arg, State &state); -} + bool parseArgument(const QByteArray &arg); + + bool valid; + bool logging; + bool visible; +}; + +} // namespace PerformanceMonitor #endif // PERFORMANCEMONITOR_H