Remove quoting from kscreen-console json-output (Bug 354534)
ClosedPublic

Authored by jbraun on Nov 30 2016, 9:12 PM.

Details

Summary

As the creator of Bug 354534 noted, the output of

kscreen-console json

contains quotations seem to be generated from the qDebug()-Output stream.

The proposed fix is to convert the QString to a C++ std::string and use std::cout for output.

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped
jbraun updated this revision to Diff 8646.Nov 30 2016, 9:12 PM
jbraun retitled this revision from to Remove quoting from kscreen-console json-output (Bug 354534).
jbraun updated this object.
jbraun edited the test plan for this revision. (Show Details)
jbraun added a reviewer: sebas.
jbraun set the repository for this revision to R104 KScreen.
Restricted Application added a project: Plasma. · View Herald TranscriptNov 30 2016, 9:12 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik added a subscriber: broulik.EditedNov 30 2016, 9:30 PM

Thanks for your patch! Instead of converting to an std::string you could try

qDebug().noquote() << doc.toJson();

[1] https://doc.qt.io/qt-5/qdebug.html#noquote

However, given Thiago complained about the usage of qDebug() in the first place, either should work. But then, I'm not a fan of converting to an std::string … Let's have sebas (as KScreen maintainer) decide. :)

sebas requested changes to this revision.Dec 1 2016, 11:31 AM
sebas edited edge metadata.

Idea in general looks good, I'd rather use QTextStream than std though. Can you change that?

b/console/console.cpp
185

In other tools, we use QTextStream for the output, I'd prefer that. See libkscreen/src/doctor.cpp for an example.

This revision now requires changes to proceed.Dec 1 2016, 11:31 AM
jbraun updated this revision to Diff 8674.Dec 1 2016, 2:05 PM
jbraun edited edge metadata.
jbraun removed R104 KScreen as the repository for this revision.

Of course, that's easily done. :-)

sebas accepted this revision.Mar 13 2017, 2:28 PM

I'm sorry that this got lost. The patch is fine, can you please push it?

Please add "BUG:354534" to the commit message, on a separate line, this will close the corresponding bugreport.

This revision is now accepted and ready to land.Mar 13 2017, 2:28 PM
aacid added a subscriber: aacid.Mar 27 2017, 10:40 PM

He can't push it, he doesn't have a devel account.

Sebas can you please push it? Name is Jan-Matthias Braun and e-mail according to identity is jan_braun@gmx.net

Or i can commit if if you tell me the repo, which you did not fill out when creating the request.

This revision was automatically updated to reflect the committed changes.