From ea63beb4aa61db4e36da0aa84521310fdf9868e0 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 24 Jul 2018 13:08:54 +0200 Subject: Use the qdebug serializer to print contacts --- sinksh/syntax_modules/sink_list.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/sinksh/syntax_modules/sink_list.cpp b/sinksh/syntax_modules/sink_list.cpp index 8b5ba5a..4e4f541 100644 --- a/sinksh/syntax_modules/sink_list.cpp +++ b/sinksh/syntax_modules/sink_list.cpp @@ -63,6 +63,17 @@ QByteArray baIfAvailable(const QStringList &list) return list.first().toUtf8(); } +template +static QString qDebugToString(const T &c) +{ + QString s; + { + QDebug debug{&s}; + debug << c; + } + return s; +} + QStringList printToList(const Sink::ApplicationDomain::ApplicationDomainType &o, bool compact, const QByteArrayList &toPrint, bool limitPropertySize) { QStringList line; @@ -88,16 +99,7 @@ QStringList printToList(const Sink::ApplicationDomain::ApplicationDomainType &o, } else if (value.canConvert()) { line << value.value().join(", "); } else if (value.canConvert>()) { - QStringList list; - for (const auto &c : value.value>()) { - QString s; - { - QDebug debug{&s}; - debug << c; - } - list << s; - } - line << list.join(", "); + list << qDebugToString(value.value>()); } else { line << QString("Unprintable type: %1").arg(value.typeName()); } -- cgit v1.2.3