From 21c39152055131d87614f051ca08566bd51f268f Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 20 Nov 2012 18:27:28 +0100 Subject: [PATCH] Multimedia: examples coding style unification Change-Id: Iffae3a276bb2b01f871aee76dc069ce006d69fce Reviewed-by: David Schulz --- examples/audiodecoder/audiodecoder.cpp | 2 +- examples/audiodecoder/audiodecoder.h | 8 +-- examples/audiodecoder/main.cpp | 13 ++--- examples/audiodecoder/wavefilewriter.cpp | 6 +-- examples/audiodecoder/wavefilewriter.h | 11 +++-- examples/audiodevices/audiodevices.cpp | 25 +++++----- examples/audiodevices/audiodevices.h | 9 ++-- examples/audioinput/audioinput.cpp | 18 +++---- examples/audioinput/audioinput.h | 19 ++++---- examples/audioinput/audioinput.pro | 4 +- examples/audiooutput/audiooutput.cpp | 8 +-- examples/audiooutput/audiooutput.h | 45 ++++++++--------- examples/audiooutput/audiooutput.pro | 4 +- examples/audiooutput/main.cpp | 7 ++- examples/audiorecorder/audiorecorder.cpp | 57 ++++++++++++---------- examples/audiorecorder/audiorecorder.h | 29 +++-------- examples/audiorecorder/main.cpp | 2 +- examples/audiorecorder/qaudiolevel.h | 2 - .../customvideoitem/customvideoitem.pro | 4 +- .../customvideosurface/customvideoitem/main.cpp | 4 +- .../customvideoitem/videoitem.cpp | 5 +- .../customvideosurface/customvideoitem/videoitem.h | 10 ++-- .../customvideoitem/videoplayer.cpp | 8 +-- .../customvideoitem/videoplayer.h | 13 +++-- .../customvideowidget/customvideowidget.pro | 4 +- .../customvideowidget/videoplayer.h | 10 ++-- .../customvideowidget/videowidget.h | 11 ++--- .../customvideowidget/videowidgetsurface.h | 9 ++-- examples/player/histogramwidget.h | 10 ++-- examples/player/main.cpp | 12 +---- examples/player/player.cpp | 10 ++-- examples/player/player.h | 21 ++++---- examples/player/player.pro | 8 +-- examples/player/playercontrols.cpp | 24 ++++----- examples/player/playercontrols.h | 11 ++--- examples/player/playlistmodel.cpp | 9 ++-- examples/player/playlistmodel.h | 8 ++- examples/player/videowidget.cpp | 6 +-- examples/player/videowidget.h | 8 +-- examples/radio/radio.cpp | 32 ++++++------ examples/radio/radio.h | 29 ++++------- examples/spectrum/app/app.pro | 5 +- examples/spectrum/app/engine.cpp | 8 +-- examples/spectrum/app/engine.h | 46 ++++++++--------- examples/spectrum/app/frequencyspectrum.cpp | 4 +- examples/spectrum/app/levelmeter.h | 6 ++- examples/spectrum/app/main.cpp | 6 +-- examples/spectrum/app/mainwidget.cpp | 1 - examples/spectrum/app/mainwidget.h | 29 ++++++----- examples/spectrum/app/progressbar.h | 7 +-- examples/spectrum/app/settingsdialog.cpp | 4 +- examples/spectrum/app/settingsdialog.h | 32 ++++++------ examples/spectrum/app/spectrograph.cpp | 4 +- examples/spectrum/app/spectrograph.h | 11 ++--- examples/spectrum/app/spectrum.h | 8 +-- examples/spectrum/app/spectrumanalyser.cpp | 13 ++--- examples/spectrum/app/spectrumanalyser.h | 2 + examples/spectrum/app/tonegenerator.cpp | 7 ++- examples/spectrum/app/tonegenerator.h | 8 +-- examples/spectrum/app/tonegeneratordialog.cpp | 11 ++--- examples/spectrum/app/tonegeneratordialog.h | 35 +++++++------ examples/spectrum/app/utils.cpp | 10 ++-- examples/spectrum/app/waveform.h | 13 +++-- examples/spectrum/app/wavfile.cpp | 2 +- examples/spectrum/app/wavfile.h | 11 ++--- examples/spectrum/spectrum.pro | 8 +-- examples/videographicsitem/main.cpp | 2 +- examples/videographicsitem/videoplayer.cpp | 8 +-- examples/videographicsitem/videoplayer.h | 10 ++-- 69 files changed, 387 insertions(+), 459 deletions(-) diff --git a/examples/audiodecoder/audiodecoder.cpp b/examples/audiodecoder/audiodecoder.cpp index 38663a4..1505a88 100644 --- a/examples/audiodecoder/audiodecoder.cpp +++ b/examples/audiodecoder/audiodecoder.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ #include "audiodecoder.h" -#include +#include AudioDecoder::AudioDecoder(bool isPlayback, bool isDelete) : m_cout(stdout, QIODevice::WriteOnly) diff --git a/examples/audiodecoder/audiodecoder.h b/examples/audiodecoder/audiodecoder.h index 7815ed7..210142d 100644 --- a/examples/audiodecoder/audiodecoder.h +++ b/examples/audiodecoder/audiodecoder.h @@ -41,16 +41,16 @@ #ifndef AUDIODECODER_H #define AUDIODECODER_H -#include #include "wavefilewriter.h" + +#include #include #include -QT_USE_NAMESPACE - class AudioDecoder : public QObject { Q_OBJECT + public: AudioDecoder(bool isPlayback, bool isDelete); ~AudioDecoder() { } @@ -61,7 +61,7 @@ public: void setTargetFilename(const QString &fileName); -Q_SIGNALS: +signals: void done(); public slots: diff --git a/examples/audiodecoder/main.cpp b/examples/audiodecoder/main.cpp index 2572a7e..fabdae9 100644 --- a/examples/audiodecoder/main.cpp +++ b/examples/audiodecoder/main.cpp @@ -38,13 +38,14 @@ ** ****************************************************************************/ -#include +#include "audiodecoder.h" + +#include +#include +#include #include -#include -#include -#include -#include "audiodecoder.h" +#include int main(int argc, char *argv[]) { @@ -90,4 +91,4 @@ int main(int argc, char *argv[]) decoder.start(); return app.exec(); -}; +} diff --git a/examples/audiodecoder/wavefilewriter.cpp b/examples/audiodecoder/wavefilewriter.cpp index f47488d..e13476d 100644 --- a/examples/audiodecoder/wavefilewriter.cpp +++ b/examples/audiodecoder/wavefilewriter.cpp @@ -107,12 +107,12 @@ bool WaveFileWriter::open(const QString& fileName, const QAudioFormat& format) return true; } -bool WaveFileWriter::write(const QAudioBuffer& buffer) +bool WaveFileWriter::write(const QAudioBuffer &buffer) { if (buffer.format() != m_format) return false; // buffer format has changed - qint64 written = file.write((const char*)buffer.constData(), buffer.byteCount()); + qint64 written = file.write((const char *)buffer.constData(), buffer.byteCount()); m_dataLength += written; return written == buffer.byteCount(); } @@ -130,7 +130,7 @@ bool WaveFileWriter::close() return result; } -bool WaveFileWriter::writeHeader(const QAudioFormat& format) +bool WaveFileWriter::writeHeader(const QAudioFormat &format) { // check if format is supported if (format.byteOrder() == QAudioFormat::BigEndian || format.sampleType() != QAudioFormat::SignedInt) diff --git a/examples/audiodecoder/wavefilewriter.h b/examples/audiodecoder/wavefilewriter.h index 8151975..180d34e 100644 --- a/examples/audiodecoder/wavefilewriter.h +++ b/examples/audiodecoder/wavefilewriter.h @@ -41,24 +41,25 @@ #ifndef WAVEFILEWRITER_H #define WAVEFILEWRITER_H +#include +#include #include -#include -#include class WaveFileWriter : public QObject { Q_OBJECT + public: explicit WaveFileWriter(QObject *parent = 0); ~WaveFileWriter(); - bool open(const QString& fileName, const QAudioFormat& format); - bool write(const QAudioBuffer& buffer); + bool open(const QString &fileName, const QAudioFormat &format); + bool write(const QAudioBuffer &buffer); bool close(); bool isOpen() const { return file.isOpen(); } private: - bool writeHeader(const QAudioFormat& format); + bool writeHeader(const QAudioFormat &format); bool writeDataLength(); QFile file; diff --git a/examples/audiodevices/audiodevices.cpp b/examples/audiodevices/audiodevices.cpp index a765d2e..2892e98 100644 --- a/examples/audiodevices/audiodevices.cpp +++ b/examples/audiodevices/audiodevices.cpp @@ -38,14 +38,11 @@ ** ****************************************************************************/ - -#include - #include "audiodevices.h" // Utility functions for converting QAudioFormat fields into text -QString toString(QAudioFormat::SampleType sampleType) +static QString toString(QAudioFormat::SampleType sampleType) { QString result("Unknown"); switch (sampleType) { @@ -64,7 +61,7 @@ QString toString(QAudioFormat::SampleType sampleType) return result; } -QString toString(QAudioFormat::Endian endian) +static QString toString(QAudioFormat::Endian endian) { QString result("Unknown"); switch (endian) { @@ -79,8 +76,8 @@ QString toString(QAudioFormat::Endian endian) } -AudioDevicesBase::AudioDevicesBase(QWidget *parent, Qt::WindowFlags f) - : QMainWindow(parent, f) +AudioDevicesBase::AudioDevicesBase(QWidget *parent) + : QMainWindow(parent) { setupUi(this); } @@ -88,8 +85,8 @@ AudioDevicesBase::AudioDevicesBase(QWidget *parent, Qt::WindowFlags f) AudioDevicesBase::~AudioDevicesBase() {} -AudioTest::AudioTest(QWidget *parent, Qt::WindowFlags f) - : AudioDevicesBase(parent, f) +AudioTest::AudioTest(QWidget *parent) + : AudioDevicesBase(parent) { mode = QAudio::AudioOutput; @@ -186,11 +183,11 @@ void AudioTest::deviceChanged(int idx) settings.setChannelCount(chz.at(0)); codecsBox->clear(); - QStringList codecz = deviceInfo.supportedCodecs(); - for (int i = 0; i < codecz.size(); ++i) - codecsBox->addItem(QString("%1").arg(codecz.at(i))); - if (codecz.size()) - settings.setCodec(codecz.at(0)); + QStringList codecs = deviceInfo.supportedCodecs(); + for (int i = 0; i < codecs.size(); ++i) + codecsBox->addItem(QString("%1").arg(codecs.at(i))); + if (codecs.size()) + settings.setCodec(codecs.at(0)); // Add false to create failed condition! codecsBox->addItem("audio/test"); diff --git a/examples/audiodevices/audiodevices.h b/examples/audiodevices/audiodevices.h index fd359c0..d1a1cd2 100644 --- a/examples/audiodevices/audiodevices.h +++ b/examples/audiodevices/audiodevices.h @@ -41,24 +41,25 @@ #ifndef AUDIODEVICES_H #define AUDIODEVICES_H -#include +#include #include -#include +#include #include "ui_audiodevicesbase.h" class AudioDevicesBase : public QMainWindow, public Ui::AudioDevicesBase { public: - AudioDevicesBase(QWidget *parent = 0, Qt::WindowFlags f = 0); + AudioDevicesBase(QWidget *parent = 0); virtual ~AudioDevicesBase(); }; class AudioTest : public AudioDevicesBase { Q_OBJECT + public: - AudioTest(QWidget *parent = 0, Qt::WindowFlags f = 0); + AudioTest(QWidget *parent = 0); virtual ~AudioTest(); QAudioDeviceInfo deviceInfo; diff --git a/examples/audioinput/audioinput.cpp b/examples/audioinput/audioinput.cpp index 51488ed..5aeb1a7 100644 --- a/examples/audioinput/audioinput.cpp +++ b/examples/audioinput/audioinput.cpp @@ -42,15 +42,12 @@ #include #include - #include #include #include - -#include -#include - -#include +#include +#include +#include #include "audioinput.h" @@ -331,15 +328,14 @@ void InputTest::notified() void InputTest::readMore() { - if(!m_audioInput) + if (!m_audioInput) return; qint64 len = m_audioInput->bytesReady(); - if(len > BufferSize) + if (len > BufferSize) len = BufferSize; qint64 l = m_input->read(m_buffer.data(), len); - if(l > 0) { + if (l > 0) m_audioInfo->write(m_buffer.constData(), l); - } } void InputTest::toggleMode() @@ -364,7 +360,7 @@ void InputTest::toggleMode() void InputTest::toggleSuspend() { // toggle suspend/resume - if(m_audioInput->state() == QAudio::SuspendedState) { + if (m_audioInput->state() == QAudio::SuspendedState) { qWarning() << "status: Suspended, resume()"; m_audioInput->resume(); m_suspendResumeButton->setText(tr(SUSPEND_LABEL)); diff --git a/examples/audioinput/audioinput.h b/examples/audioinput/audioinput.h index 76bae26..83bf66f 100644 --- a/examples/audioinput/audioinput.h +++ b/examples/audioinput/audioinput.h @@ -41,20 +41,20 @@ #ifndef AUDIOINPUT_H #define AUDIOINPUT_H -#include -#include -#include +#include +#include +#include #include +#include +#include #include -#include -#include #include - -#include +#include class AudioInfo : public QIODevice { Q_OBJECT + public: AudioInfo(const QAudioFormat &format, QObject *parent); ~AudioInfo(); @@ -94,9 +94,11 @@ private: QPixmap m_pixmap; }; + class InputTest : public QMainWindow { Q_OBJECT + public: InputTest(); ~InputTest(); @@ -133,5 +135,4 @@ private: QByteArray m_buffer; }; -#endif - +#endif // AUDIOINPUT_H diff --git a/examples/audioinput/audioinput.pro b/examples/audioinput/audioinput.pro index f4cdc31..d2ee4bd 100644 --- a/examples/audioinput/audioinput.pro +++ b/examples/audioinput/audioinput.pro @@ -1,7 +1,7 @@ TEMPLATE = app TARGET = audioinput -QT += multimedia +QT += multimedia widgets HEADERS = audioinput.h @@ -13,5 +13,3 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/audioinput INSTALLS += target sources - -QT+=widgets diff --git a/examples/audiooutput/audiooutput.cpp b/examples/audiooutput/audiooutput.cpp index 918892b..4328e4e 100644 --- a/examples/audiooutput/audiooutput.cpp +++ b/examples/audiooutput/audiooutput.cpp @@ -38,13 +38,13 @@ ** ****************************************************************************/ +#include +#include #include #include +#include +#include -#include -#include -#include -#include #include "audiooutput.h" #define PUSH_MODE_LABEL "Enable push mode" diff --git a/examples/audiooutput/audiooutput.h b/examples/audiooutput/audiooutput.h index 04c4622..52c29cc 100644 --- a/examples/audiooutput/audiooutput.h +++ b/examples/audiooutput/audiooutput.h @@ -43,21 +43,21 @@ #include -#include -#include +#include +#include +#include +#include #include +#include +#include +#include #include -#include #include -#include -#include -#include - -#include class Generator : public QIODevice { Q_OBJECT + public: Generator(const QAudioFormat &format, qint64 durationUs, int sampleRate, QObject *parent); ~Generator(); @@ -80,6 +80,7 @@ private: class AudioTest : public QMainWindow { Q_OBJECT + public: AudioTest(); ~AudioTest(); @@ -90,23 +91,24 @@ private: void createAudioOutput(); private: - QTimer* m_pullTimer; + QTimer *m_pullTimer; // Owned by layout - QPushButton* m_modeButton; - QPushButton* m_suspendResumeButton; - QComboBox* m_deviceBox; - QLabel* m_volumeLabel; - QSlider* m_volumeSlider; + QPushButton *m_modeButton; + QPushButton *m_suspendResumeButton; + QComboBox *m_deviceBox; + QLabel *m_volumeLabel; + QSlider *m_volumeSlider; QAudioDeviceInfo m_device; - Generator* m_generator; - QAudioOutput* m_audioOutput; - QIODevice* m_output; // not owned - QAudioFormat m_format; + Generator *m_generator; + QAudioOutput *m_audioOutput; + QIODevice *m_output; // not owned + QAudioFormat m_format; + + bool m_pullMode; + QByteArray m_buffer; - bool m_pullMode; - QByteArray m_buffer; private slots: void notified(); void pullTimerExpired(); @@ -117,5 +119,4 @@ private slots: void volumeChanged(int); }; -#endif - +#endif // AUDIOOUTPUT_H diff --git a/examples/audiooutput/audiooutput.pro b/examples/audiooutput/audiooutput.pro index 1b6bf19..70aad89 100644 --- a/examples/audiooutput/audiooutput.pro +++ b/examples/audiooutput/audiooutput.pro @@ -1,7 +1,7 @@ TEMPLATE = app TARGET = audiooutput -QT += multimedia +QT += multimedia widgets HEADERS = audiooutput.h @@ -13,5 +13,3 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/audiooutput INSTALLS += target sources - -QT+=widgets diff --git a/examples/audiooutput/main.cpp b/examples/audiooutput/main.cpp index ea49d9b..097cabb 100644 --- a/examples/audiooutput/main.cpp +++ b/examples/audiooutput/main.cpp @@ -38,14 +38,13 @@ ** ****************************************************************************/ - -#include +#include #include "audiooutput.h" -int main(int argv, char **args) +int main(int argc, char *argv[]) { - QApplication app(argv, args); + QApplication app(argc, argv); app.setApplicationName("Audio Output Test"); AudioTest audio; diff --git a/examples/audiorecorder/audiorecorder.cpp b/examples/audiorecorder/audiorecorder.cpp index 12a3a4d..6c65f2e 100644 --- a/examples/audiorecorder/audiorecorder.cpp +++ b/examples/audiorecorder/audiorecorder.cpp @@ -38,12 +38,11 @@ ** ****************************************************************************/ -#include -#include - -#include -#include -#include +#include +#include +#include +#include +#include #include "audiorecorder.h" @@ -53,8 +52,13 @@ #include "ui_audiorecorder.h" #endif -AudioRecorder::AudioRecorder(QWidget *parent) - : +static qreal getPeakValue(const QAudioFormat &format); +static qreal getBufferLevel(const QAudioBuffer &buffer); + +template +static qreal getBufferLevel(const T *buffer, int samples); + +AudioRecorder::AudioRecorder(QWidget *parent) : QMainWindow(parent), ui(new Ui::AudioRecorder), outputLocationSet(false) @@ -63,7 +67,7 @@ AudioRecorder::AudioRecorder(QWidget *parent) audioRecorder = new QAudioRecorder(this); probe = new QAudioProbe; - connect(probe, SIGNAL(audioBufferProbed(const QAudioBuffer&)), this, SLOT(processBuffer(QAudioBuffer))); + connect(probe, SIGNAL(audioBufferProbed(QAudioBuffer)), this, SLOT(processBuffer(QAudioBuffer))); probe->setSource(audioRecorder); //audio devices @@ -216,19 +220,20 @@ QUrl AudioRecorder::generateAudioFilePath() int lastImage = 0; int fileCount = 0; - foreach(QString fileName, outputDir.entryList(QStringList() << "testclip_*")) { + foreach (const QString &fileName, outputDir.entryList(QStringList(QString("testclip_*")))) { int imgNumber = fileName.mid(5, fileName.size() - 9).toInt(); lastImage = qMax(lastImage, imgNumber); if (outputDir.exists(fileName)) fileCount += 1; } lastImage += fileCount; - QUrl location(QDir::toNativeSeparators(outputDir.canonicalPath() + QString("/testclip_%1").arg(lastImage + 1, 4, 10, QLatin1Char('0')))); + QUrl location(QDir::toNativeSeparators(outputDir.canonicalPath() + + QString("/testclip_%1").arg(lastImage + 1, 4, 10, QLatin1Char('0')))); return location; } // This function returns the maximum possible sample value for a given audio format -qreal AudioRecorder::GetPeakValue(const QAudioFormat& format) +qreal getPeakValue(const QAudioFormat& format) { // Note: Only the most common sample formats are supported if (!format.isValid()) @@ -247,9 +252,9 @@ qreal AudioRecorder::GetPeakValue(const QAudioFormat& format) case QAudioFormat::SignedInt: if (format.sampleSize() == 32) return 2147483648.0; - else if (format.sampleSize() == 16) + if (format.sampleSize() == 16) return 32768.0; - else if (format.sampleSize() == 8) + if (format.sampleSize() == 8) return 128.0; break; case QAudioFormat::UnSignedInt: @@ -260,7 +265,7 @@ qreal AudioRecorder::GetPeakValue(const QAudioFormat& format) return 0.0; } -qreal AudioRecorder::GetBufferLevel(const QAudioBuffer& buffer) +qreal getBufferLevel(const QAudioBuffer& buffer) { if (!buffer.format().isValid() || buffer.format().byteOrder() != QAudioFormat::LittleEndian) return 0.0; @@ -268,7 +273,7 @@ qreal AudioRecorder::GetBufferLevel(const QAudioBuffer& buffer) if (buffer.format().codec() != "audio/pcm") return 0.0; - qreal peak_value = GetPeakValue(buffer.format()); + qreal peak_value = getPeakValue(buffer.format()); if (qFuzzyCompare(peak_value, 0.0)) return 0.0; @@ -278,15 +283,15 @@ qreal AudioRecorder::GetBufferLevel(const QAudioBuffer& buffer) break; case QAudioFormat::Float: if (buffer.format().sampleSize() == 32) - return GetBufferLevel(buffer.constData(), buffer.sampleCount()) / peak_value; + return getBufferLevel(buffer.constData(), buffer.sampleCount()) / peak_value; break; case QAudioFormat::SignedInt: if (buffer.format().sampleSize() == 32) - return GetBufferLevel(buffer.constData(), buffer.sampleCount()) / peak_value; - else if (buffer.format().sampleSize() == 16) - return GetBufferLevel(buffer.constData(), buffer.sampleCount()) / peak_value; - else if (buffer.format().sampleSize() == 8) - return GetBufferLevel(buffer.constData(), buffer.sampleCount()) / peak_value; + return getBufferLevel(buffer.constData(), buffer.sampleCount()) / peak_value; + if (buffer.format().sampleSize() == 16) + return getBufferLevel(buffer.constData(), buffer.sampleCount()) / peak_value; + if (buffer.format().sampleSize() == 8) + return getBufferLevel(buffer.constData(), buffer.sampleCount()) / peak_value; break; } @@ -294,12 +299,12 @@ qreal AudioRecorder::GetBufferLevel(const QAudioBuffer& buffer) } template -qreal AudioRecorder::GetBufferLevel(const T* buffer, int samples) +qreal getBufferLevel(const T *buffer, int samples) { qreal max_value = 0.0; - for (int i = 0; i < samples; i++) { - qreal value = qAbs((qreal)buffer[i]); + for (int i = 0; i < samples; ++i) { + qreal value = qAbs(qreal(buffer[i])); if (value > max_value) max_value = value; } @@ -309,6 +314,6 @@ qreal AudioRecorder::GetBufferLevel(const T* buffer, int samples) void AudioRecorder::processBuffer(const QAudioBuffer& buffer) { - qreal level = GetBufferLevel(buffer); + qreal level = getBufferLevel(buffer); ui->audioLevel->setLevel(level); } diff --git a/examples/audiorecorder/audiorecorder.h b/examples/audiorecorder/audiorecorder.h index cb389a9..a58daf5 100644 --- a/examples/audiorecorder/audiorecorder.h +++ b/examples/audiorecorder/audiorecorder.h @@ -41,28 +41,21 @@ #ifndef AUDIORECORDER_H #define AUDIORECORDER_H -#include -#include - -#include - +#include +#include +#include QT_BEGIN_NAMESPACE - -namespace Ui { - class AudioRecorder; -} - +namespace Ui { class AudioRecorder; } class QAudioRecorder; class QAudioProbe; class QAudioBuffer; QT_END_NAMESPACE -QT_USE_NAMESPACE - class AudioRecorder : public QMainWindow { Q_OBJECT + public: AudioRecorder(QWidget *parent = 0); ~AudioRecorder(); @@ -81,18 +74,12 @@ private slots: QUrl generateAudioFilePath(); private: - static qreal GetPeakValue(const QAudioFormat& format); - static qreal GetBufferLevel(const QAudioBuffer& buffer); - - template - static qreal GetBufferLevel(const T* buffer, int samples); - Ui::AudioRecorder *ui; - QAudioRecorder* audioRecorder; - QAudioProbe* probe; + QAudioRecorder *audioRecorder; + QAudioProbe *probe; bool outputLocationSet; }; -#endif +#endif // AUDIORECORDER_H diff --git a/examples/audiorecorder/main.cpp b/examples/audiorecorder/main.cpp index e8322f5..532cfc8 100644 --- a/examples/audiorecorder/main.cpp +++ b/examples/audiorecorder/main.cpp @@ -50,4 +50,4 @@ int main(int argc, char *argv[]) recorder.show(); return app.exec(); -}; +} diff --git a/examples/audiorecorder/qaudiolevel.h b/examples/audiorecorder/qaudiolevel.h index b4c5cef..7a9dd07 100644 --- a/examples/audiorecorder/qaudiolevel.h +++ b/examples/audiorecorder/qaudiolevel.h @@ -43,8 +43,6 @@ #include -QT_USE_NAMESPACE - class QAudioLevel : public QWidget { Q_OBJECT diff --git a/examples/customvideosurface/customvideoitem/customvideoitem.pro b/examples/customvideosurface/customvideoitem/customvideoitem.pro index a2a7a1e..92d1e8d 100644 --- a/examples/customvideosurface/customvideoitem/customvideoitem.pro +++ b/examples/customvideosurface/customvideoitem/customvideoitem.pro @@ -1,7 +1,7 @@ TEMPLATE = app TARGET = customvideoitem -QT += multimedia multimediawidgets +QT += multimedia multimediawidgets widgets contains(QT_CONFIG, opengl): QT += opengl @@ -17,5 +17,3 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/customvideoitem INSTALLS += target sources - -QT+=widgets diff --git a/examples/customvideosurface/customvideoitem/main.cpp b/examples/customvideosurface/customvideoitem/main.cpp index d1899c7..18f602f 100644 --- a/examples/customvideosurface/customvideoitem/main.cpp +++ b/examples/customvideosurface/customvideoitem/main.cpp @@ -40,9 +40,9 @@ #include "videoplayer.h" -#include +#include -int main(int argc, char **argv) +int main(int argc, char *argv[]) { QApplication app(argc, argv); diff --git a/examples/customvideosurface/customvideoitem/videoitem.cpp b/examples/customvideosurface/customvideoitem/videoitem.cpp index f42d8bb..db6651e 100644 --- a/examples/customvideosurface/customvideoitem/videoitem.cpp +++ b/examples/customvideosurface/customvideoitem/videoitem.cpp @@ -40,8 +40,9 @@ #include "videoitem.h" -#include -#include +#include +#include +#include VideoItem::VideoItem(QGraphicsItem *parent) : QGraphicsItem(parent) diff --git a/examples/customvideosurface/customvideoitem/videoitem.h b/examples/customvideosurface/customvideoitem/videoitem.h index 75261dd..2836057 100644 --- a/examples/customvideosurface/customvideoitem/videoitem.h +++ b/examples/customvideosurface/customvideoitem/videoitem.h @@ -41,8 +41,8 @@ #ifndef VIDEOITEM_H #define VIDEOITEM_H -#include -#include +#include +#include class VideoItem : public QAbstractVideoSurface, @@ -50,13 +50,13 @@ class VideoItem { Q_OBJECT Q_INTERFACES(QGraphicsItem) + public: explicit VideoItem(QGraphicsItem *parentItem = 0); ~VideoItem(); QRectF boundingRect() const; - void paint( - QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); //video surface QList supportedPixelFormats( @@ -74,5 +74,5 @@ private: bool framePainted; }; -#endif +#endif // VIDEOITEM_H diff --git a/examples/customvideosurface/customvideoitem/videoplayer.cpp b/examples/customvideosurface/customvideoitem/videoplayer.cpp index da4aa88..c76160d 100644 --- a/examples/customvideosurface/customvideoitem/videoplayer.cpp +++ b/examples/customvideosurface/customvideoitem/videoplayer.cpp @@ -42,14 +42,14 @@ #include "videoitem.h" #include -#include +#include #if !defined(QT_NO_OPENGL) -# include +# include #endif -VideoPlayer::VideoPlayer(QWidget *parent, Qt::WindowFlags flags) - : QWidget(parent, flags) +VideoPlayer::VideoPlayer(QWidget *parent) + : QWidget(parent) , mediaPlayer(0, QMediaPlayer::VideoSurface) , videoItem(0) , playButton(0) diff --git a/examples/customvideosurface/customvideoitem/videoplayer.h b/examples/customvideosurface/customvideoitem/videoplayer.h index 2fcbe09..5b4db4e 100644 --- a/examples/customvideosurface/customvideoitem/videoplayer.h +++ b/examples/customvideosurface/customvideoitem/videoplayer.h @@ -41,24 +41,23 @@ #ifndef VIDEOPLAYER_H #define VIDEOPLAYER_H -#include - -#include -#include +#include +#include +#include QT_BEGIN_NAMESPACE class QAbstractButton; class QSlider; QT_END_NAMESPACE - class VideoItem; class VideoPlayer : public QWidget { Q_OBJECT + public: - VideoPlayer(QWidget *parent = 0, Qt::WindowFlags flags = 0); + VideoPlayer(QWidget *parent = 0); ~VideoPlayer(); QSize sizeHint() const { return QSize(800, 600); } @@ -81,5 +80,5 @@ private: QSlider *positionSlider; }; -#endif +#endif // VIDEOPLAYER_H diff --git a/examples/customvideosurface/customvideowidget/customvideowidget.pro b/examples/customvideosurface/customvideowidget/customvideowidget.pro index c3ac2cd..ddea2f7 100644 --- a/examples/customvideosurface/customvideowidget/customvideowidget.pro +++ b/examples/customvideosurface/customvideowidget/customvideowidget.pro @@ -1,7 +1,7 @@ TEMPLATE = app TARGET = customvideowidget -QT += multimedia multimediawidgets +QT += multimedia multimediawidgets widgets HEADERS = \ videoplayer.h \ @@ -19,5 +19,3 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/customvideowidget INSTALLS += target sources - -QT+=widgets diff --git a/examples/customvideosurface/customvideowidget/videoplayer.h b/examples/customvideosurface/customvideowidget/videoplayer.h index ddad187..7aff44f 100644 --- a/examples/customvideosurface/customvideowidget/videoplayer.h +++ b/examples/customvideosurface/customvideowidget/videoplayer.h @@ -41,10 +41,9 @@ #ifndef VIDEOPLAYER_H #define VIDEOPLAYER_H -#include - -#include -#include +#include +#include +#include QT_BEGIN_NAMESPACE class QAbstractButton; @@ -54,6 +53,7 @@ QT_END_NAMESPACE class VideoPlayer : public QWidget { Q_OBJECT + public: VideoPlayer(QWidget *parent = 0); ~VideoPlayer(); @@ -74,4 +74,4 @@ private: QSlider *positionSlider; }; -#endif +#endif // VIDEOPLAYER_H diff --git a/examples/customvideosurface/customvideowidget/videowidget.h b/examples/customvideosurface/customvideowidget/videowidget.h index c7688dd..9b9bd0f 100644 --- a/examples/customvideosurface/customvideowidget/videowidget.h +++ b/examples/customvideosurface/customvideowidget/videowidget.h @@ -43,18 +43,13 @@ #include "videowidgetsurface.h" -#include - -QT_BEGIN_NAMESPACE -class QAbstractVideoSurface; -QT_END_NAMESPACE - -class VideoWidgetSurface; +#include //! [0] class VideoWidget : public QWidget { Q_OBJECT + public: VideoWidget(QWidget *parent = 0); ~VideoWidget(); @@ -72,4 +67,4 @@ private: }; //! [0] -#endif +#endif // VIDEOWIDGET_H diff --git a/examples/customvideosurface/customvideowidget/videowidgetsurface.h b/examples/customvideosurface/customvideowidget/videowidgetsurface.h index 6cfa346..3e9c40b 100644 --- a/examples/customvideosurface/customvideowidget/videowidgetsurface.h +++ b/examples/customvideosurface/customvideowidget/videowidgetsurface.h @@ -41,15 +41,16 @@ #ifndef VIDEOWIDGETSURFACE_H #define VIDEOWIDGETSURFACE_H -#include -#include -#include -#include +#include +#include +#include +#include //! [0] class VideoWidgetSurface : public QAbstractVideoSurface { Q_OBJECT + public: VideoWidgetSurface(QWidget *widget, QObject *parent = 0); diff --git a/examples/player/histogramwidget.h b/examples/player/histogramwidget.h index 6607a74..6a8aa16 100644 --- a/examples/player/histogramwidget.h +++ b/examples/player/histogramwidget.h @@ -41,13 +41,12 @@ #ifndef HISTOGRAMWIDGET_H #define HISTOGRAMWIDGET_H -#include -#include #include +#include +#include -QT_USE_NAMESPACE - -class FrameProcessor: public QObject { +class FrameProcessor: public QObject +{ Q_OBJECT public slots: @@ -60,6 +59,7 @@ signals: class HistogramWidget : public QWidget { Q_OBJECT + public: explicit HistogramWidget(QWidget *parent = 0); ~HistogramWidget(); diff --git a/examples/player/main.cpp b/examples/player/main.cpp index 9d27d45..4754a03 100644 --- a/examples/player/main.cpp +++ b/examples/player/main.cpp @@ -40,7 +40,7 @@ #include "player.h" -#include +#include int main(int argc, char *argv[]) { @@ -53,18 +53,10 @@ int main(int argc, char *argv[]) Player player; #if defined(Q_WS_SIMULATOR) -# if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 2)) player.setAttribute(Qt::WA_LockLandscapeOrientation); -# else - // lock screen orientation - CAknAppUi* appUi = dynamic_cast(CEikonEnv::Static()->AppUi()); - if(appUi){ - QT_TRAP_THROWING(appUi ->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape)); - } -# endif player.showMaximized(); #else player.show(); #endif return app.exec(); -}; +} diff --git a/examples/player/player.cpp b/examples/player/player.cpp index 9169f3c..fbc3e57 100644 --- a/examples/player/player.cpp +++ b/examples/player/player.cpp @@ -44,10 +44,9 @@ #include "playlistmodel.h" #include "histogramwidget.h" -#include -#include -#include - +#include +#include +#include #include @@ -308,7 +307,7 @@ void Player::statusChanged(QMediaPlayer::MediaStatus status) void Player::handleCursor(QMediaPlayer::MediaStatus status) { #ifndef QT_NO_CURSOR - if( status == QMediaPlayer::LoadingMedia || + if (status == QMediaPlayer::LoadingMedia || status == QMediaPlayer::BufferingMedia || status == QMediaPlayer::StalledMedia) setCursor(QCursor(Qt::BusyCursor)); @@ -427,4 +426,3 @@ void Player::showColorDialog() colorDialog->show(); } #endif - diff --git a/examples/player/player.h b/examples/player/player.h index fd2b7d1..66f1b16 100644 --- a/examples/player/player.h +++ b/examples/player/player.h @@ -41,38 +41,35 @@ #ifndef PLAYER_H #define PLAYER_H -#include - -#include -#include #include "videowidget.h" +#include +#include +#include QT_BEGIN_NAMESPACE class QAbstractItemView; class QLabel; +class QMediaPlayer; class QModelIndex; -class QSlider; class QPushButton; +class QSlider; class QVideoProbe; - -class QMediaPlayer; class QVideoWidget; QT_END_NAMESPACE -QT_USE_NAMESPACE - class PlaylistModel; class HistogramWidget; class Player : public QWidget { Q_OBJECT + public: Player(QWidget *parent = 0); ~Player(); -Q_SIGNALS: +signals: void fullScreenChanged(bool fullScreen); private slots: @@ -96,7 +93,7 @@ private slots: #ifndef PLAYER_NO_COLOROPTIONS void showColorDialog(); #endif - void addToPlaylist(const QStringList& fileNames); + void addToPlaylist(const QStringList &fileNames); private: void setTrackInfo(const QString &info); @@ -127,4 +124,4 @@ private: qint64 duration; }; -#endif +#endif // PLAYER_H diff --git a/examples/player/player.pro b/examples/player/player.pro index 5259418..49d9d3a 100644 --- a/examples/player/player.pro +++ b/examples/player/player.pro @@ -1,12 +1,11 @@ TEMPLATE = app TARGET = player -CONFIG += qt warn_on - QT += network \ xml \ multimedia \ - multimediawidgets + multimediawidgets \ + widgets HEADERS = \ player.h \ @@ -25,10 +24,7 @@ maemo* { DEFINES += PLAYER_NO_COLOROPTIONS } -#install target.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/player sources.files = $$SOURCES $HEADERS $$RESOURCES $$FORMS *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/player INSTALLS += target sources - -QT+=widgets diff --git a/examples/player/playercontrols.cpp b/examples/player/playercontrols.cpp index 99c5848..1f18fc0 100644 --- a/examples/player/playercontrols.cpp +++ b/examples/player/playercontrols.cpp @@ -40,11 +40,11 @@ #include "playercontrols.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include PlayerControls::PlayerControls(QWidget *parent) : QWidget(parent) @@ -89,7 +89,6 @@ PlayerControls::PlayerControls(QWidget *parent) connect(volumeSlider, SIGNAL(sliderMoved(int)), this, SIGNAL(changeVolume(int))); - rateBox = new QComboBox(this); rateBox->addItem("0.5x", QVariant(0.5)); rateBox->addItem("1.0x", QVariant(1.0)); @@ -105,11 +104,8 @@ PlayerControls::PlayerControls(QWidget *parent) layout->addWidget(playButton); layout->addWidget(nextButton); layout->addWidget(muteButton); - if (volumeSlider) - layout->addWidget(volumeSlider); - - if (rateBox) - layout->addWidget(rateBox); + layout->addWidget(volumeSlider); + layout->addWidget(rateBox); setLayout(layout); } @@ -192,15 +188,15 @@ qreal PlayerControls::playbackRate() const void PlayerControls::setPlaybackRate(float rate) { - for (int i=0; icount(); i++) { + for (int i = 0; i < rateBox->count(); ++i) { if (qFuzzyCompare(rate, float(rateBox->itemData(i).toDouble()))) { rateBox->setCurrentIndex(i); return; } } - rateBox->addItem( QString("%1x").arg(rate), QVariant(rate)); - rateBox->setCurrentIndex(rateBox->count()-1); + rateBox->addItem(QString("%1x").arg(rate), QVariant(rate)); + rateBox->setCurrentIndex(rateBox->count() - 1); } void PlayerControls::updateRate() diff --git a/examples/player/playercontrols.h b/examples/player/playercontrols.h index 23ba8e1..35ae302 100644 --- a/examples/player/playercontrols.h +++ b/examples/player/playercontrols.h @@ -41,9 +41,8 @@ #ifndef PLAYERCONTROLS_H #define PLAYERCONTROLS_H -#include - -#include +#include +#include QT_BEGIN_NAMESPACE class QAbstractButton; @@ -51,16 +50,14 @@ class QAbstractSlider; class QComboBox; QT_END_NAMESPACE -QT_USE_NAMESPACE - class PlayerControls : public QWidget { Q_OBJECT + public: PlayerControls(QWidget *parent = 0); QMediaPlayer::State state() const; - int volume() const; bool isMuted() const; qreal playbackRate() const; @@ -98,4 +95,4 @@ private: QComboBox *rateBox; }; -#endif +#endif // PLAYERCONTROLS_H diff --git a/examples/player/playlistmodel.cpp b/examples/player/playlistmodel.cpp index 8f95a87..bf10153 100644 --- a/examples/player/playlistmodel.cpp +++ b/examples/player/playlistmodel.cpp @@ -40,10 +40,9 @@ #include "playlistmodel.h" -#include -#include - -#include +#include +#include +#include PlaylistModel::PlaylistModel(QObject *parent) : QAbstractItemModel(parent) @@ -155,5 +154,3 @@ void PlaylistModel::changeItems(int start, int end) m_data.clear(); emit dataChanged(index(start,0), index(end,ColumnCount)); } - - diff --git a/examples/player/playlistmodel.h b/examples/player/playlistmodel.h index b29fed7..59d2028 100644 --- a/examples/player/playlistmodel.h +++ b/examples/player/playlistmodel.h @@ -41,18 +41,16 @@ #ifndef PLAYLISTMODEL_H #define PLAYLISTMODEL_H -#include -#include +#include QT_BEGIN_NAMESPACE class QMediaPlaylist; QT_END_NAMESPACE -QT_USE_NAMESPACE - class PlaylistModel : public QAbstractItemModel { Q_OBJECT + public: enum Column { @@ -87,4 +85,4 @@ private: QMap m_data; }; -#endif +#endif // PLAYLISTMODEL_H diff --git a/examples/player/videowidget.cpp b/examples/player/videowidget.cpp index 1dfbf94..5e07bd3 100644 --- a/examples/player/videowidget.cpp +++ b/examples/player/videowidget.cpp @@ -40,7 +40,8 @@ #include "videowidget.h" -#include +#include +#include VideoWidget::VideoWidget(QWidget *parent) : QVideoWidget(parent) @@ -58,11 +59,9 @@ void VideoWidget::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Escape && isFullScreen()) { setFullScreen(false); - event->accept(); } else if (event->key() == Qt::Key_Enter && event->modifiers() & Qt::Key_Alt) { setFullScreen(!isFullScreen()); - event->accept(); } else { QVideoWidget::keyPressEvent(event); @@ -72,7 +71,6 @@ void VideoWidget::keyPressEvent(QKeyEvent *event) void VideoWidget::mouseDoubleClickEvent(QMouseEvent *event) { setFullScreen(!isFullScreen()); - event->accept(); } diff --git a/examples/player/videowidget.h b/examples/player/videowidget.h index 2edcfb0..9a520e7 100644 --- a/examples/player/videowidget.h +++ b/examples/player/videowidget.h @@ -37,16 +37,16 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #ifndef VIDEOWIDGET_H #define VIDEOWIDGET_H -#include - -QT_USE_NAMESPACE +#include class VideoWidget : public QVideoWidget { Q_OBJECT + public: VideoWidget(QWidget *parent = 0); @@ -56,4 +56,4 @@ protected: void mousePressEvent(QMouseEvent *event); }; -#endif +#endif // VIDEOWIDGET_H diff --git a/examples/radio/radio.cpp b/examples/radio/radio.cpp index 80f860f..24edccf 100644 --- a/examples/radio/radio.cpp +++ b/examples/radio/radio.cpp @@ -40,27 +40,25 @@ #include "radio.h" -#include - Radio::Radio() { radio = new QRadioTuner; connect(radio, SIGNAL(error(QRadioTuner::Error)), this, SLOT(error(QRadioTuner::Error))); - if(radio->isBandSupported(QRadioTuner::FM)) + if (radio->isBandSupported(QRadioTuner::FM)) radio->setBand(QRadioTuner::FM); QWidget *window = new QWidget; - QVBoxLayout* layout = new QVBoxLayout; - QHBoxLayout* buttonBar = new QHBoxLayout; - QHBoxLayout* topBar = new QHBoxLayout; + QVBoxLayout *layout = new QVBoxLayout; + QHBoxLayout *buttonBar = new QHBoxLayout; + QHBoxLayout *topBar = new QHBoxLayout; layout->addLayout(topBar); freq = new QLabel; freq->setText(QString("%1 kHz").arg(radio->frequency()/1000)); topBar->addWidget(freq); - connect(radio,SIGNAL(frequencyChanged(int)),this,SLOT(freqChanged(int))); + connect(radio, SIGNAL(frequencyChanged(int)), SLOT(freqChanged(int))); signal = new QLabel; if (radio->isAvailable()) @@ -68,34 +66,34 @@ Radio::Radio() else signal->setText(tr("No radio found")); topBar->addWidget(signal); - connect(radio,SIGNAL(signalStrengthChanged(int)),this,SLOT(signalChanged(int))); + connect(radio, SIGNAL(signalStrengthChanged(int)), SLOT(signalChanged(int))); volumeSlider = new QSlider(Qt::Vertical,this); - volumeSlider->setRange(0,100); + volumeSlider->setRange(0, 100); volumeSlider->setValue(50); - connect(volumeSlider,SIGNAL(valueChanged(int)),this,SLOT(updateVolume(int))); + connect(volumeSlider, SIGNAL(valueChanged(int)), SLOT(updateVolume(int))); topBar->addWidget(volumeSlider); layout->addLayout(buttonBar); searchLeft = new QPushButton; searchLeft->setText(tr("scan Down")); - connect(searchLeft,SIGNAL(clicked()),SLOT(searchDown())); + connect(searchLeft, SIGNAL(clicked()), SLOT(searchDown())); buttonBar->addWidget(searchLeft); left = new QPushButton; left->setText(tr("Freq Down")); - connect(left,SIGNAL(clicked()),SLOT(freqDown())); + connect(left, SIGNAL(clicked()), SLOT(freqDown())); buttonBar->addWidget(left); right = new QPushButton; - connect(right,SIGNAL(clicked()),SLOT(freqUp())); + connect(right, SIGNAL(clicked()), SLOT(freqUp())); right->setText(tr("Freq Up")); buttonBar->addWidget(right); searchRight = new QPushButton; searchRight->setText(tr("scan Up")); - connect(searchRight,SIGNAL(clicked()),SLOT(searchUp())); + connect(searchRight, SIGNAL(clicked()), SLOT(searchUp())); buttonBar->addWidget(searchRight); window->setLayout(layout); @@ -112,14 +110,14 @@ Radio::~Radio() void Radio::freqUp() { int f = radio->frequency(); - f = f + radio->frequencyStep(QRadioTuner::FM); + f += radio->frequencyStep(QRadioTuner::FM); radio->setFrequency(f); } void Radio::freqDown() { int f = radio->frequency(); - f = f - radio->frequencyStep(QRadioTuner::FM); + f -= radio->frequencyStep(QRadioTuner::FM); radio->setFrequency(f); } @@ -153,7 +151,7 @@ void Radio::updateVolume(int v) void Radio::error(QRadioTuner::Error error) { - const QMetaObject* metaObj = radio->metaObject(); + const QMetaObject *metaObj = radio->metaObject(); QMetaEnum errorEnum = metaObj->enumerator(metaObj->indexOfEnumerator("Error")); qWarning().nospace() << "Warning: Example application received error QRadioTuner::" << errorEnum.valueToKey(error); } diff --git a/examples/radio/radio.h b/examples/radio/radio.h index 69e3871..f598766 100644 --- a/examples/radio/radio.h +++ b/examples/radio/radio.h @@ -42,16 +42,7 @@ #define RADIO_H #include - -#include - -QT_BEGIN_NAMESPACE -class QLabel; -class QPushButton; -class QSlider; -QT_END_NAMESPACE - -QT_USE_NAMESPACE +#include class Radio : public QMainWindow { @@ -71,14 +62,14 @@ public slots: void error(QRadioTuner::Error error); private: - QLabel* freq; - QLabel* signal; - QPushButton* left; - QPushButton* right; - QPushButton* searchLeft; - QPushButton* searchRight; - QSlider* volumeSlider; - QRadioTuner* radio; + QLabel *freq; + QLabel *signal; + QPushButton *left; + QPushButton *right; + QPushButton *searchLeft; + QPushButton *searchRight; + QSlider *volumeSlider; + QRadioTuner *radio; }; -#endif +#endif // RADIO_H diff --git a/examples/spectrum/app/app.pro b/examples/spectrum/app/app.pro index 647dbb8..712fafc 100644 --- a/examples/spectrum/app/app.pro +++ b/examples/spectrum/app/app.pro @@ -6,7 +6,7 @@ TEMPLATE = app TARGET = spectrum -QT += multimedia +QT += multimedia widgets SOURCES += main.cpp \ engine.cpp \ @@ -89,6 +89,3 @@ macx { QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN } } - - -QT+=widgets diff --git a/examples/spectrum/app/engine.cpp b/examples/spectrum/app/engine.cpp index 11fc58a..908cb9d 100644 --- a/examples/spectrum/app/engine.cpp +++ b/examples/spectrum/app/engine.cpp @@ -44,14 +44,14 @@ #include +#include +#include #include +#include +#include #include #include -#include -#include -#include #include -#include //----------------------------------------------------------------------------- // Constants diff --git a/examples/spectrum/app/engine.h b/examples/spectrum/app/engine.h index f281adc..f3ca5c9 100644 --- a/examples/spectrum/app/engine.h +++ b/examples/spectrum/app/engine.h @@ -45,12 +45,13 @@ #include "spectrumanalyser.h" #include "wavfile.h" -#include -#include +#include +#include #include +#include +#include +#include #include -#include -#include #ifdef DUMP_CAPTURED_AUDIO #define DUMP_DATA @@ -60,14 +61,11 @@ #define DUMP_DATA #endif -#ifdef DUMP_DATA -#include -#endif - class FrequencySpectrum; -QT_FORWARD_DECLARE_CLASS(QAudioInput) -QT_FORWARD_DECLARE_CLASS(QAudioOutput) -QT_FORWARD_DECLARE_CLASS(QFile) +QT_BEGIN_NAMESPACE +class QAudioInput; +class QAudioOutput; +QT_END_NAMESPACE /** * This class interfaces with the QtMultimedia audio classes, and also with @@ -75,26 +73,28 @@ QT_FORWARD_DECLARE_CLASS(QFile) * of audio data, meanwhile performing real-time analysis of the audio level * and frequency spectrum. */ -class Engine : public QObject { +class Engine : public QObject +{ Q_OBJECT + public: - Engine(QObject *parent = 0); + explicit Engine(QObject *parent = 0); ~Engine(); - const QList& availableAudioInputDevices() const + const QList &availableAudioInputDevices() const { return m_availableAudioInputDevices; } - const QList& availableAudioOutputDevices() const + const QList &availableAudioOutputDevices() const { return m_availableAudioOutputDevices; } - QAudio::Mode mode() const { return m_mode; } - QAudio::State state() const { return m_state; } + QAudio::Mode mode() const { return m_mode; } + QAudio::State state() const { return m_state; } /** * \return Current audio format * \note May be QAudioFormat() if engine is not initialized */ - const QAudioFormat& format() const { return m_format; } + const QAudioFormat& format() const { return m_format; } /** * Stop any ongoing recording or playback, and reset to ground state. @@ -125,25 +125,25 @@ public: * Position of the audio input device. * \return Position in bytes. */ - qint64 recordPosition() const { return m_recordPosition; } + qint64 recordPosition() const { return m_recordPosition; } /** * RMS level of the most recently processed set of audio samples. * \return Level in range (0.0, 1.0) */ - qreal rmsLevel() const { return m_rmsLevel; } + qreal rmsLevel() const { return m_rmsLevel; } /** * Peak level of the most recently processed set of audio samples. * \return Level in range (0.0, 1.0) */ - qreal peakLevel() const { return m_peakLevel; } + qreal peakLevel() const { return m_peakLevel; } /** * Position of the audio output device. * \return Position in bytes. */ - qint64 playPosition() const { return m_playPosition; } + qint64 playPosition() const { return m_playPosition; } /** * Length of the internal engine buffer. @@ -155,7 +155,7 @@ public: * Amount of data held in the buffer. * \return Data length in bytes. */ - qint64 dataLength() const { return m_dataLength; } + qint64 dataLength() const { return m_dataLength; } /** * Set window function applied to audio data before spectral analysis. diff --git a/examples/spectrum/app/frequencyspectrum.cpp b/examples/spectrum/app/frequencyspectrum.cpp index e535d42..6a7fd1f 100644 --- a/examples/spectrum/app/frequencyspectrum.cpp +++ b/examples/spectrum/app/frequencyspectrum.cpp @@ -58,12 +58,12 @@ int FrequencySpectrum::count() const return m_elements.count(); } -FrequencySpectrum::Element& FrequencySpectrum::operator[](int index) +FrequencySpectrum::Element &FrequencySpectrum::operator[](int index) { return m_elements[index]; } -const FrequencySpectrum::Element& FrequencySpectrum::operator[](int index) const +const FrequencySpectrum::Element &FrequencySpectrum::operator[](int index) const { return m_elements[index]; } diff --git a/examples/spectrum/app/levelmeter.h b/examples/spectrum/app/levelmeter.h index c5fc01e..53147ff 100644 --- a/examples/spectrum/app/levelmeter.h +++ b/examples/spectrum/app/levelmeter.h @@ -49,10 +49,12 @@ * RMS and peak levels of the window of audio samples most recently analyzed * by the Engine. */ -class LevelMeter : public QWidget { +class LevelMeter : public QWidget +{ Q_OBJECT + public: - LevelMeter(QWidget *parent = 0); + explicit LevelMeter(QWidget *parent = 0); ~LevelMeter(); void paintEvent(QPaintEvent *event); diff --git a/examples/spectrum/app/main.cpp b/examples/spectrum/app/main.cpp index f713d9d..7f47beb 100644 --- a/examples/spectrum/app/main.cpp +++ b/examples/spectrum/app/main.cpp @@ -38,15 +38,15 @@ ** ****************************************************************************/ -#include #include "mainwidget.h" +#include -int main(int argc, char **argv) +int main(int argc, char *argv[]) { QApplication app(argc, argv); app.setApplicationName("QtMultimedia spectrum analyzer"); - MainWidget w; + MainWidget w; w.show(); return app.exec(); diff --git a/examples/spectrum/app/mainwidget.cpp b/examples/spectrum/app/mainwidget.cpp index 408fb17..ea1f0ad 100644 --- a/examples/spectrum/app/mainwidget.cpp +++ b/examples/spectrum/app/mainwidget.cpp @@ -445,4 +445,3 @@ void MainWidget::updateModeMenu() m_generateToneAction->setChecked(GenerateToneMode == m_mode); m_recordAction->setChecked(RecordMode == m_mode); } - diff --git a/examples/spectrum/app/mainwidget.h b/examples/spectrum/app/mainwidget.h index 2a2d21b..971d903 100644 --- a/examples/spectrum/app/mainwidget.h +++ b/examples/spectrum/app/mainwidget.h @@ -41,33 +41,37 @@ #ifndef MAINWIDGET_H #define MAINWIDGET_H -#include +#include #include -#include +#include class Engine; class FrequencySpectrum; -class ProgressBar; -class Spectrograph; -class Waveform; class LevelMeter; +class ProgressBar; class SettingsDialog; +class Spectrograph; class ToneGeneratorDialog; +class Waveform; -QT_FORWARD_DECLARE_CLASS(QAudioFormat) -QT_FORWARD_DECLARE_CLASS(QLabel) -QT_FORWARD_DECLARE_CLASS(QPushButton) -QT_FORWARD_DECLARE_CLASS(QMenu) -QT_FORWARD_DECLARE_CLASS(QAction) +QT_BEGIN_NAMESPACE +class QAction; +class QAudioFormat; +class QLabel; +class QMenu; +class QPushButton; +QT_END_NAMESPACE /** * Main application widget, responsible for connecting the various UI * elements to the Engine. */ -class MainWidget : public QWidget { +class MainWidget : public QWidget +{ Q_OBJECT + public: - MainWidget(QWidget *parent = 0); + explicit MainWidget(QWidget *parent = 0); ~MainWidget(); // QObject @@ -138,7 +142,6 @@ private: QAction* m_loadFileAction; QAction* m_generateToneAction; QAction* m_recordAction; - }; #endif // MAINWIDGET_H diff --git a/examples/spectrum/app/progressbar.h b/examples/spectrum/app/progressbar.h index abcab92..9ee505d 100644 --- a/examples/spectrum/app/progressbar.h +++ b/examples/spectrum/app/progressbar.h @@ -47,10 +47,12 @@ * Widget which displays a the current fill state of the Engine's internal * buffer, and the current play/record position within that buffer. */ -class ProgressBar : public QWidget { +class ProgressBar : public QWidget +{ Q_OBJECT + public: - ProgressBar(QWidget *parent = 0); + explicit ProgressBar(QWidget *parent = 0); ~ProgressBar(); void reset(); @@ -68,7 +70,6 @@ private: qint64 m_playPosition; qint64 m_windowPosition; qint64 m_windowLength; - }; #endif // PROGRESSBAR_H diff --git a/examples/spectrum/app/settingsdialog.cpp b/examples/spectrum/app/settingsdialog.cpp index f3025be..abca697 100644 --- a/examples/spectrum/app/settingsdialog.cpp +++ b/examples/spectrum/app/settingsdialog.cpp @@ -39,14 +39,14 @@ ****************************************************************************/ #include "settingsdialog.h" +#include #include #include #include #include -#include -#include #include #include +#include SettingsDialog::SettingsDialog( const QList &availableInputDevices, diff --git a/examples/spectrum/app/settingsdialog.h b/examples/spectrum/app/settingsdialog.h index 1d262d9..0ce114d 100644 --- a/examples/spectrum/app/settingsdialog.h +++ b/examples/spectrum/app/settingsdialog.h @@ -43,29 +43,33 @@ #include "spectrum.h" #include -#include +#include -QT_FORWARD_DECLARE_CLASS(QComboBox) -QT_FORWARD_DECLARE_CLASS(QCheckBox) -QT_FORWARD_DECLARE_CLASS(QSlider) -QT_FORWARD_DECLARE_CLASS(QSpinBox) -QT_FORWARD_DECLARE_CLASS(QGridLayout) +QT_BEGIN_NAMESPACE +class QComboBox; +class QCheckBox; +class QSlider; +class QSpinBox; +class QGridLayout; +QT_END_NAMESPACE /** * Dialog used to control settings such as the audio input / output device * and the windowing function. */ -class SettingsDialog : public QDialog { +class SettingsDialog : public QDialog +{ Q_OBJECT + public: SettingsDialog(const QList &availableInputDevices, const QList &availableOutputDevices, QWidget *parent = 0); ~SettingsDialog(); - WindowFunction windowFunction() const { return m_windowFunction; } - const QAudioDeviceInfo& inputDevice() const { return m_inputDevice; } - const QAudioDeviceInfo& outputDevice() const { return m_outputDevice; } + WindowFunction windowFunction() const { return m_windowFunction; } + const QAudioDeviceInfo &inputDevice() const { return m_inputDevice; } + const QAudioDeviceInfo &outputDevice() const { return m_outputDevice; } private slots: void windowFunctionChanged(int index); @@ -77,11 +81,9 @@ private: QAudioDeviceInfo m_inputDevice; QAudioDeviceInfo m_outputDevice; - QComboBox* m_inputDeviceComboBox; - QComboBox* m_outputDeviceComboBox; - - QComboBox* m_windowFunctionComboBox; - + QComboBox *m_inputDeviceComboBox; + QComboBox *m_outputDeviceComboBox; + QComboBox *m_windowFunctionComboBox; }; #endif // SETTINGSDIALOG_H diff --git a/examples/spectrum/app/spectrograph.cpp b/examples/spectrum/app/spectrograph.cpp index eb69d14..b1785e7 100644 --- a/examples/spectrum/app/spectrograph.cpp +++ b/examples/spectrum/app/spectrograph.cpp @@ -39,9 +39,9 @@ ****************************************************************************/ #include "spectrograph.h" -#include -#include #include +#include +#include #include const int NullTimerId = -1; diff --git a/examples/spectrum/app/spectrograph.h b/examples/spectrum/app/spectrograph.h index c74537a..470d4e5 100644 --- a/examples/spectrum/app/spectrograph.h +++ b/examples/spectrum/app/spectrograph.h @@ -41,19 +41,20 @@ #ifndef SPECTROGRAPH_H #define SPECTROGRAPH_H -#include #include "frequencyspectrum.h" -QT_FORWARD_DECLARE_CLASS(QMouseEvent) +#include /** * Widget which displays a spectrograph showing the frequency spectrum * of the window of audio samples most recently analyzed by the Engine. */ -class Spectrograph : public QWidget { +class Spectrograph : public QWidget +{ Q_OBJECT + public: - Spectrograph(QWidget *parent = 0); + explicit Spectrograph(QWidget *parent = 0); ~Spectrograph(); void setParams(int numBars, qreal lowFreq, qreal highFreq); @@ -92,8 +93,6 @@ private: qreal m_lowFreq; qreal m_highFreq; FrequencySpectrum m_spectrum; - - }; #endif // SPECTROGRAPH_H diff --git a/examples/spectrum/app/spectrum.h b/examples/spectrum/app/spectrum.h index 1a3943f..f79aaa9 100644 --- a/examples/spectrum/app/spectrum.h +++ b/examples/spectrum/app/spectrum.h @@ -41,7 +41,7 @@ #ifndef SPECTRUM_H #define SPECTRUM_H -#include +#include #include "utils.h" #include "fftreal_wrapper.h" // For FFTLengthPowerOfTwo @@ -89,7 +89,8 @@ enum WindowFunction { const WindowFunction DefaultWindowFunction = HannWindow; -struct Tone { +struct Tone +{ Tone(qreal freq = 0.0, qreal amp = 0.0) : frequency(freq), amplitude(amp) { } @@ -101,7 +102,8 @@ struct Tone { qreal amplitude; }; -struct SweptTone { +struct SweptTone +{ SweptTone(qreal start = 0.0, qreal end = 0.0, qreal amp = 0.0) : startFreq(start), endFreq(end), amplitude(amp) { Q_ASSERT(end >= start); } diff --git a/examples/spectrum/app/spectrumanalyser.cpp b/examples/spectrum/app/spectrumanalyser.cpp index 5421f11..d3fe511 100644 --- a/examples/spectrum/app/spectrumanalyser.cpp +++ b/examples/spectrum/app/spectrumanalyser.cpp @@ -40,14 +40,13 @@ #include "spectrumanalyser.h" #include "utils.h" +#include "fftreal_wrapper.h" -#include -#include -#include +#include +#include +#include #include -#include "fftreal_wrapper.h" - SpectrumAnalyserThread::SpectrumAnalyserThread(QObject *parent) : QObject(parent) #ifndef DISABLE_FFT @@ -275,7 +274,3 @@ void SpectrumAnalyser::calculationComplete(const FrequencySpectrum &spectrum) emit spectrumChanged(spectrum); m_state = Idle; } - - - - diff --git a/examples/spectrum/app/spectrumanalyser.h b/examples/spectrum/app/spectrumanalyser.h index d96b842..582d032 100644 --- a/examples/spectrum/app/spectrumanalyser.h +++ b/examples/spectrum/app/spectrumanalyser.h @@ -72,6 +72,7 @@ class SpectrumAnalyserThreadPrivate; class SpectrumAnalyserThread : public QObject { Q_OBJECT + public: SpectrumAnalyserThread(QObject *parent); ~SpectrumAnalyserThread(); @@ -121,6 +122,7 @@ private: class SpectrumAnalyser : public QObject { Q_OBJECT + public: SpectrumAnalyser(QObject *parent = 0); ~SpectrumAnalyser(); diff --git a/examples/spectrum/app/tonegenerator.cpp b/examples/spectrum/app/tonegenerator.cpp index e21af5c..51a1de3 100644 --- a/examples/spectrum/app/tonegenerator.cpp +++ b/examples/spectrum/app/tonegenerator.cpp @@ -41,9 +41,9 @@ #include "spectrum.h" #include "utils.h" #include -#include -#include -#include +#include +#include +#include void generateTone(const SweptTone &tone, const QAudioFormat &format, QByteArray &buffer) { @@ -88,4 +88,3 @@ void generateTone(const SweptTone &tone, const QAudioFormat &format, QByteArray phaseStep += phaseStepStep; } } - diff --git a/examples/spectrum/app/tonegenerator.h b/examples/spectrum/app/tonegenerator.h index 7b67b4a..40cfc3d 100644 --- a/examples/spectrum/app/tonegenerator.h +++ b/examples/spectrum/app/tonegenerator.h @@ -41,11 +41,13 @@ #ifndef TONEGENERATOR_H #define TONEGENERATOR_H -#include +#include #include "spectrum.h" -QT_FORWARD_DECLARE_CLASS(QAudioFormat) -QT_FORWARD_DECLARE_CLASS(QByteArray) +QT_BEGIN_NAMESPACE +class QAudioFormat; +class QByteArray; +QT_END_NAMESPACE /** * Generate a sine wave diff --git a/examples/spectrum/app/tonegeneratordialog.cpp b/examples/spectrum/app/tonegeneratordialog.cpp index 99adfaf..27c9d0d 100644 --- a/examples/spectrum/app/tonegeneratordialog.cpp +++ b/examples/spectrum/app/tonegeneratordialog.cpp @@ -77,26 +77,23 @@ ToneGeneratorDialog::ToneGeneratorDialog(QWidget *parent) m_amplitudeSlider->setValue(ToneGeneratorAmplitudeDefault); // Add widgets to layout - - QScopedPointer frequencyControlLayout(new QGridLayout); + QGridLayout *frequencyControlLayout = new QGridLayout; QLabel *frequencyLabel = new QLabel(tr("Frequency (Hz)"), this); frequencyControlLayout->addWidget(frequencyLabel, 0, 0, 2, 1); frequencyControlLayout->addWidget(m_frequencySlider, 0, 1); frequencyControlLayout->addWidget(m_frequencySpinBox, 1, 1); - m_toneGeneratorFrequencyControl->setLayout(frequencyControlLayout.data()); - frequencyControlLayout.take(); // ownership transferred to m_toneGeneratorFrequencyControl + m_toneGeneratorFrequencyControl->setLayout(frequencyControlLayout); m_toneGeneratorFrequencyControl->setEnabled(false); - QScopedPointer toneGeneratorLayout(new QGridLayout); + QGridLayout *toneGeneratorLayout = new QGridLayout; QLabel *amplitudeLabel = new QLabel(tr("Amplitude"), this); toneGeneratorLayout->addWidget(m_toneGeneratorSweepCheckBox, 0, 1); toneGeneratorLayout->addWidget(m_toneGeneratorFrequencyControl, 1, 0, 1, 2); toneGeneratorLayout->addWidget(amplitudeLabel, 2, 0); toneGeneratorLayout->addWidget(m_amplitudeSlider, 2, 1); - m_toneGeneratorControl->setLayout(toneGeneratorLayout.data()); + m_toneGeneratorControl->setLayout(toneGeneratorLayout); m_toneGeneratorControl->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); dialogLayout->addWidget(m_toneGeneratorControl); - toneGeneratorLayout.take(); // ownership transferred // Connect CHECKED_CONNECT(m_toneGeneratorSweepCheckBox, SIGNAL(toggled(bool)), diff --git a/examples/spectrum/app/tonegeneratordialog.h b/examples/spectrum/app/tonegeneratordialog.h index dd2f5fa..a38a1f6 100644 --- a/examples/spectrum/app/tonegeneratordialog.h +++ b/examples/spectrum/app/tonegeneratordialog.h @@ -42,21 +42,25 @@ #define TONEGENERATORDIALOG_H #include "spectrum.h" +#include #include -#include -QT_FORWARD_DECLARE_CLASS(QCheckBox) -QT_FORWARD_DECLARE_CLASS(QSlider) -QT_FORWARD_DECLARE_CLASS(QSpinBox) -QT_FORWARD_DECLARE_CLASS(QGridLayout) +QT_BEGIN_NAMESPACE +class QCheckBox; +class QSlider; +class QSpinBox; +class QGridLayout; +QT_END_NAMESPACE /** * Dialog which controls the parameters of the tone generator. */ -class ToneGeneratorDialog : public QDialog { +class ToneGeneratorDialog : public QDialog +{ Q_OBJECT + public: - ToneGeneratorDialog(QWidget *parent = 0); + explicit ToneGeneratorDialog(QWidget *parent = 0); ~ToneGeneratorDialog(); bool isFrequencySweepEnabled() const; @@ -67,15 +71,14 @@ private slots: void frequencySweepEnabled(bool enabled); private: - QCheckBox* m_toneGeneratorSweepCheckBox; - bool m_frequencySweepEnabled; - QWidget* m_toneGeneratorControl; - QWidget* m_toneGeneratorFrequencyControl; - QSlider* m_frequencySlider; - QSpinBox* m_frequencySpinBox; - qreal m_frequency; - QSlider* m_amplitudeSlider; - + QCheckBox *m_toneGeneratorSweepCheckBox; + bool m_frequencySweepEnabled; + QWidget *m_toneGeneratorControl; + QWidget *m_toneGeneratorFrequencyControl; + QSlider *m_frequencySlider; + QSpinBox *m_frequencySpinBox; + qreal m_frequency; + QSlider *m_amplitudeSlider; }; #endif // TONEGENERATORDIALOG_H diff --git a/examples/spectrum/app/utils.cpp b/examples/spectrum/app/utils.cpp index 5defb78..92e2d6d 100644 --- a/examples/spectrum/app/utils.cpp +++ b/examples/spectrum/app/utils.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "utils.h" qint64 audioDuration(const QAudioFormat &format, qint64 bytes) @@ -119,10 +119,10 @@ bool isPCM(const QAudioFormat &format) bool isPCMS16LE(const QAudioFormat &format) { - return (isPCM(format) && - format.sampleType() == QAudioFormat::SignedInt && - format.sampleSize() == 16 && - format.byteOrder() == QAudioFormat::LittleEndian); + return isPCM(format) && + format.sampleType() == QAudioFormat::SignedInt && + format.sampleSize() == 16 && + format.byteOrder() == QAudioFormat::LittleEndian; } const qint16 PCMS16MaxValue = 32767; diff --git a/examples/spectrum/app/waveform.h b/examples/spectrum/app/waveform.h index 2aaec80..019e86a 100644 --- a/examples/spectrum/app/waveform.h +++ b/examples/spectrum/app/waveform.h @@ -41,12 +41,10 @@ #ifndef WAVEFORM_H #define WAVEFORM_H -#include -#include +#include #include #include - -QT_FORWARD_DECLARE_CLASS(QByteArray) +#include /** * Widget which displays a section of the audio waveform. @@ -57,10 +55,12 @@ QT_FORWARD_DECLARE_CLASS(QByteArray) * outside the widget, it is moved to the right end of the tile array and * painted with the next section of the waveform. */ -class Waveform : public QWidget { +class Waveform : public QWidget +{ Q_OBJECT + public: - Waveform(QWidget *parent = 0); + explicit Waveform(QWidget *parent = 0); ~Waveform(); // QWidget @@ -197,7 +197,6 @@ private: qint64 m_windowPosition; qint64 m_windowLength; - }; #endif // WAVEFORM_H diff --git a/examples/spectrum/app/wavfile.cpp b/examples/spectrum/app/wavfile.cpp index a41d4dd..dc1655c 100644 --- a/examples/spectrum/app/wavfile.cpp +++ b/examples/spectrum/app/wavfile.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include "utils.h" diff --git a/examples/spectrum/app/wavfile.h b/examples/spectrum/app/wavfile.h index b5bd052..9770713 100644 --- a/examples/spectrum/app/wavfile.h +++ b/examples/spectrum/app/wavfile.h @@ -38,13 +38,12 @@ ** ****************************************************************************/ - #ifndef WAVFILE_H #define WAVFILE_H -#include -#include -#include +#include +#include +#include class WavFile : public QFile { @@ -62,8 +61,6 @@ private: private: QAudioFormat m_fileFormat; qint64 m_headerLength; - }; -#endif - +#endif // WAVFILE_H diff --git a/examples/spectrum/spectrum.pro b/examples/spectrum/spectrum.pro index 662d652..0dbb771 100644 --- a/examples/spectrum/spectrum.pro +++ b/examples/spectrum/spectrum.pro @@ -4,11 +4,9 @@ TEMPLATE = subdirs # Ensure that library is built before application CONFIG += ordered +QT += widgets -!contains(DEFINES, DISABLE_FFT) { - SUBDIRS += 3rdparty/fftreal -} - +!contains(DEFINES, DISABLE_FFT): SUBDIRS += 3rdparty/fftreal SUBDIRS += app TARGET = spectrum @@ -16,5 +14,3 @@ TARGET = spectrum sources.files = README.txt spectrum.pri spectrum.pro TODO.txt sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/spectrum INSTALLS += sources - -QT+=widgets diff --git a/examples/videographicsitem/main.cpp b/examples/videographicsitem/main.cpp index 1d54791..c8920ad 100644 --- a/examples/videographicsitem/main.cpp +++ b/examples/videographicsitem/main.cpp @@ -40,7 +40,7 @@ #include "videoplayer.h" -#include +#include int main(int argc, char **argv) { diff --git a/examples/videographicsitem/videoplayer.cpp b/examples/videographicsitem/videoplayer.cpp index b202673..caf84cd 100644 --- a/examples/videographicsitem/videoplayer.cpp +++ b/examples/videographicsitem/videoplayer.cpp @@ -41,11 +41,11 @@ #include "videoplayer.h" #include -#include -#include +#include +#include -VideoPlayer::VideoPlayer(QWidget *parent, Qt::WindowFlags flags) - : QWidget(parent, flags) +VideoPlayer::VideoPlayer(QWidget *parent) + : QWidget(parent) , mediaPlayer(0, QMediaPlayer::VideoSurface) , videoItem(0) , playButton(0) diff --git a/examples/videographicsitem/videoplayer.h b/examples/videographicsitem/videoplayer.h index a43911b..a958b81 100644 --- a/examples/videographicsitem/videoplayer.h +++ b/examples/videographicsitem/videoplayer.h @@ -41,10 +41,9 @@ #ifndef VIDEOPLAYER_H #define VIDEOPLAYER_H -#include - -#include -#include +#include +#include +#include QT_BEGIN_NAMESPACE class QAbstractButton; @@ -55,8 +54,9 @@ QT_END_NAMESPACE class VideoPlayer : public QWidget { Q_OBJECT + public: - VideoPlayer(QWidget *parent = 0, Qt::WindowFlags flags = 0); + VideoPlayer(QWidget *parent = 0); ~VideoPlayer(); QSize sizeHint() const { return QSize(800, 600); } -- 2.7.4