From 0a07f9ce8532847a80ab7a9ed4c35129b71c0c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Sat, 6 Aug 2016 22:15:49 +0200 Subject: Fix cover debug output --- src/library/coverart.cpp | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'src/library/coverart.cpp') 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 +#include #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(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(art))); + .arg(coverInfoToString(art), + toDebugString(art.image.size())); } const quint16 CoverInfoRelative::kNullImageHash = CoverArtUtils::calculateHash(QImage()); -- cgit v1.2.3