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/qaudio.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/qaudio.cpp')
-rw-r--r-- | src/multimedia/audio/qaudio.cpp | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/src/multimedia/audio/qaudio.cpp b/src/multimedia/audio/qaudio.cpp index d32b4efe5..8b452a118 100644 --- a/src/multimedia/audio/qaudio.cpp +++ b/src/multimedia/audio/qaudio.cpp @@ -86,59 +86,62 @@ Q_CONSTRUCTOR_FUNCTION(qRegisterAudioMetaTypes) #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, QAudio::Error error) { - QDebug nospace = dbg.nospace(); + QDebugStateSaver saver(dbg); + dbg.nospace(); switch (error) { case QAudio::NoError: - nospace << "NoError"; + dbg << "NoError"; break; case QAudio::OpenError: - nospace << "OpenError"; + dbg << "OpenError"; break; case QAudio::IOError: - nospace << "IOError"; + dbg << "IOError"; break; case QAudio::UnderrunError: - nospace << "UnderrunError"; + dbg << "UnderrunError"; break; case QAudio::FatalError: - nospace << "FatalError"; + dbg << "FatalError"; break; } - return nospace; + return dbg; } QDebug operator<<(QDebug dbg, QAudio::State state) { - QDebug nospace = dbg.nospace(); + QDebugStateSaver saver(dbg); + dbg.nospace(); switch (state) { case QAudio::ActiveState: - nospace << "ActiveState"; + dbg << "ActiveState"; break; case QAudio::SuspendedState: - nospace << "SuspendedState"; + dbg << "SuspendedState"; break; case QAudio::StoppedState: - nospace << "StoppedState"; + dbg << "StoppedState"; break; case QAudio::IdleState: - nospace << "IdleState"; + dbg << "IdleState"; break; } - return nospace; + return dbg; } QDebug operator<<(QDebug dbg, QAudio::Mode mode) { - QDebug nospace = dbg.nospace(); + QDebugStateSaver saver(dbg); + dbg.nospace(); switch (mode) { case QAudio::AudioInput: - nospace << "AudioInput"; + dbg << "AudioInput"; break; case QAudio::AudioOutput: - nospace << "AudioOutput"; + dbg << "AudioOutput"; break; } - return nospace; + return dbg; } #endif |