diff options
author | Daniel Schürmann <daschuer@mixxx.org> | 2016-08-06 22:15:49 +0200 |
---|---|---|
committer | Daniel Schürmann <daschuer@mixxx.org> | 2016-08-06 22:29:34 +0200 |
commit | 0a07f9ce8532847a80ab7a9ed4c35129b71c0c4b (patch) | |
tree | f065e374388dd12d61693e15b4826f8a4cdd106a /src/library/coverart.cpp | |
parent | b4fef08545765c1d12d33f75515a5caed14f9b9d (diff) |
Fix cover debug output
Diffstat (limited to 'src/library/coverart.cpp')
-rw-r--r-- | src/library/coverart.cpp | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/library/coverart.cpp b/src/library/coverart.cpp index 89f324ade4..4c517abe37 100644 --- a/src/library/coverart.cpp +++ b/src/library/coverart.cpp @@ -1,9 +1,12 @@ #include <QtDebug> +#include <QLatin1Literal> #include "library/coverart.h" #include "library/coverartutils.h" #include "util/debug.h" +namespace { + QString sourceToString(CoverInfo::Source source) { switch (source) { case CoverInfo::UNKNOWN: @@ -28,24 +31,33 @@ QString typeToString(CoverInfo::Type type) { return "INVALID TYPE VALUE"; } -QDebug operator<<(QDebug dbg, const CoverInfoRelative& info) { - return dbg.maybeSpace() << QString("CoverInfo(%1,%2,%3,%4)") - .arg(typeToString(info.type), - sourceToString(info.source), - info.coverLocation, - QString::number(info.hash)); +QString coverInfoRelativeToString(const CoverInfoRelative& infoRelative) { + return typeToString(infoRelative.type) % QLatin1Literal(",") % + sourceToString(infoRelative.source) % QLatin1Literal(",") % + infoRelative.coverLocation % QLatin1Literal(",") % + QLatin1Literal("0x") % QString::number(infoRelative.hash, 16); +} + +QString coverInfoToString(const CoverInfo& info) { + return coverInfoRelativeToString(info) % QLatin1Literal(",") % + info.trackLocation % QLatin1Literal(","); +} +} // anonymous namespace + +QDebug operator<<(QDebug dbg, const CoverInfoRelative& infoRelative) { + return dbg.maybeSpace() << QString("CoverInfoRelative(%1)") + .arg(coverInfoRelativeToString(infoRelative)); } QDebug operator<<(QDebug dbg, const CoverInfo& info) { - return dbg.maybeSpace() << QString("CoverInfo(%1,%2)") - .arg(toDebugString(static_cast<CoverInfoRelative>(info)), - info.trackLocation); + return dbg.maybeSpace() << QString("CoverInfo(%1)") + .arg(coverInfoToString(info)); } QDebug operator<<(QDebug dbg, const CoverArt& art) { return dbg.maybeSpace() << QString("CoverArt(%1,%2)") - .arg(toDebugString(art.image.size()), - toDebugString(static_cast<CoverInfo>(art))); + .arg(coverInfoToString(art), + toDebugString(art.image.size())); } const quint16 CoverInfoRelative::kNullImageHash = CoverArtUtils::calculateHash(QImage()); |