diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-04-01 17:09:45 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-04-07 17:21:38 +0000 |
commit | 4d17db19f895ddaa778120c346d8a6a33a710194 (patch) | |
tree | 5c931f662f4a793cb82fb5f2099f595990e25437 /src/multimedia/audio/qaudioformat.cpp | |
parent | 9fccf8064dea35f324f822b30116828acc3855a9 (diff) |
Fix debug stream operators.
- Use QDebugStateSaver to restore space setting in stream operators
instead of returning dbg.space() which breaks formatting on streams
that already have nospace() set.
- Fix some single character string constants, streamline code.
Change-Id: I18ae7324b172ea801aa9b5fe56ddf6fe527fdde9
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Diffstat (limited to 'src/multimedia/audio/qaudioformat.cpp')
-rw-r--r-- | src/multimedia/audio/qaudioformat.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp index 2c9aafb8b..1249ea998 100644 --- a/src/multimedia/audio/qaudioformat.cpp +++ b/src/multimedia/audio/qaudioformat.cpp @@ -459,49 +459,50 @@ int QAudioFormat::bytesPerFrame() const #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, QAudioFormat::Endian endian) { - QDebug nospace = dbg.nospace(); + QDebugStateSaver saver(dbg); + dbg.nospace(); switch (endian) { case QAudioFormat::BigEndian: - nospace << "BigEndian"; + dbg << "BigEndian"; break; case QAudioFormat::LittleEndian: - nospace << "LittleEndian"; + dbg << "LittleEndian"; break; } - return nospace; + return dbg; } QDebug operator<<(QDebug dbg, QAudioFormat::SampleType type) { - QDebug nospace = dbg.nospace(); + QDebugStateSaver saver(dbg); + dbg.nospace(); switch (type) { case QAudioFormat::SignedInt: - nospace << "SignedInt"; + dbg << "SignedInt"; break; case QAudioFormat::UnSignedInt: - nospace << "UnSignedInt"; + dbg << "UnSignedInt"; break; case QAudioFormat::Float: - nospace << "Float"; + dbg << "Float"; break; default: - nospace << "Unknown"; + dbg << "Unknown"; break; } - return nospace; + return dbg; } QDebug operator<<(QDebug dbg, const QAudioFormat &f) { - dbg.nospace() << "QAudioFormat(" << f.sampleRate(); - dbg.nospace() << "Hz, " << f.sampleSize(); - dbg.nospace() << "bit, channelCount=" << f.channelCount(); - dbg.nospace() << ", sampleType=" << f.sampleType(); - dbg.nospace() << ", byteOrder=" << f.byteOrder(); - dbg.nospace() << ", codec=" << f.codec(); - dbg.nospace() << ")"; - - return dbg.space(); + QDebugStateSaver saver(dbg); + dbg.nospace(); + dbg << "QAudioFormat(" << f.sampleRate() << "Hz, " + << f.sampleSize() << "bit, channelCount=" << f.channelCount() + << ", sampleType=" << f.sampleType() << ", byteOrder=" << f.byteOrder() + << ", codec=" << f.codec() << ')'; + + return dbg; } #endif |