Skip to content

Commit

Permalink
Merge pull request #4358 from Holzhaus/qdebugsaver
Browse files Browse the repository at this point in the history
Use QDebugStateSaver to reset debug formatting
  • Loading branch information
uklotzde committed Oct 6, 2021
2 parents fe3aa11 + 74dbe93 commit 47fc290
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 16 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/analyzer/plugins/analyzersoundtouchbeats.cpp
src/analyzer/plugins/buffering_utils.cpp
src/analyzer/trackanalysisscheduler.cpp
src/audio/frame.cpp
src/audio/types.cpp
src/audio/signalinfo.cpp
src/audio/streaminfo.cpp
Expand Down
17 changes: 17 additions & 0 deletions src/audio/frame.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "audio/frame.h"

namespace mixxx {
namespace audio {

QDebug operator<<(QDebug dbg, FramePos arg) {
if (arg.isValid()) {
QDebugStateSaver saver(dbg);
dbg.nospace() << "FramePos(" << arg.value() << ")";
} else {
dbg << "FramePos()";
}
return dbg;
}

} // namespace audio
} // namespace mixxx
9 changes: 1 addition & 8 deletions src/audio/frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,7 @@ inline bool operator!=(FramePos frame1, FramePos frame2) {
return !(frame1 == frame2);
}

inline QDebug operator<<(QDebug dbg, FramePos arg) {
if (arg.isValid()) {
dbg.nospace() << "FramePos(" << arg.value() << ")";
} else {
dbg << "FramePos()";
}
return dbg;
}
QDebug operator<<(QDebug dbg, FramePos arg);

constexpr FramePos kInvalidFramePos = FramePos(FramePos::kInvalidValue);
constexpr FramePos kStartFramePos = FramePos(FramePos::kStartValue);
Expand Down
10 changes: 10 additions & 0 deletions src/track/bpm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,14 @@ QString Bpm::displayValueText(double value) {
return QString("%1").arg(value, 3, 'f', 1);
}

QDebug operator<<(QDebug dbg, Bpm arg) {
if (arg.isValid()) {
QDebugStateSaver saver(dbg);
dbg.nospace() << "Bpm(" << arg.value() << ")";
} else {
dbg << "Bpm(Invalid)";
}
return dbg;
}

} // namespace mixxx
9 changes: 1 addition & 8 deletions src/track/bpm.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,7 @@ inline bool operator>=(Bpm bpm1, Bpm bpm2) {
return bpm2 <= bpm1;
}

inline QDebug operator<<(QDebug dbg, Bpm arg) {
if (arg.isValid()) {
dbg.nospace() << "Bpm(" << arg.value() << ")";
} else {
dbg << "Bpm(Invalid)";
}
return dbg;
}
QDebug operator<<(QDebug dbg, Bpm arg);
}

Q_DECLARE_TYPEINFO(mixxx::Bpm, Q_MOVABLE_TYPE);
Expand Down

0 comments on commit 47fc290

Please sign in to comment.