The documentation was previously code-heavy and short on exposition,
while focusing almost entirely on the CBOR converters. Prune most of
the CBOR code quotes, shuffle some snippet markers, add and remove
others and rewrite the main text.
Shift focus to the base-class for converters and how it's used by
main(). Retain relative focus on the CBOR converters, as they are
relatively full-featured hence illustrate more than the others do, and
replace the sequence of single-line sections about the others with a
section collecting all into a table and saying some general things
about them.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I8d41f25c165eb1a7ba20cb68aee6ab6b2fd050f8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The Out-only converters shouldn't need to implement loadFile(), as it
shouldn't be called - a converter is not used for input unless it says
it supports input. At the same time, provide the "ground state"
implementations for optionsHelp(), outputOptions() and probeFile() to
save the trivial implementations the need to duplicate one another.
In the process, make the handling of loadFile()'s outputConverter more
consistent among those that do implement it. Always set
outputConverter if it's initially null (the caller does assert this).
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I856d12c791d1f8e0accdb7dd1412d493117b2302
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Mostly to pave the way for moving the class code to a file of its own,
but this incidentally saves the need to std::as_const() every use.
Moving the underlying object to a local static of a private method
also saves the need for heap allocation (which was leaked).
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I30f4bf3c46d39e04d0ac4e3e9ba431945ebb9193
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
The Converter class, in the eponymous example, had a null member
variable that wasn't a nullptr - it pointed to an instance of
NullConverter - so that other converters could test whether a
Converter * they'd been passed was null (in the sense of pointing to a
NullConverter). This, however, was susceptible to misreading - I
misread one such comparison as a nullptr check and thus thought it
redundant with an earlier actual nullptr check. To spare future
readers similar confusion, replace the public static member variable
with a protected (since only other derived classes need it) static
predicate, to at least give the reader a clue that this is using the
word null in a class-specific sense.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I1e4f494b303d1bf90107f8c6fa3a4a22f6d81b90
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The old name didn't say what sort of thing it was converting; and our
guidelines for examples discourage using the word Example in the
title. Also reword the description of the tool in the command-line
parser and an assertion.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I6f52f5227362b4b807c8aabfd2103287af42bca0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
The serialization conversion example used raw C's way to abort on
error; change to using Qt's way of doing the same. Likewise, convert
the various other uses of fprintf(stderr, ...) to qWarning() and of
printf(...) to qInfo().
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ia8821d3c20f58f71c106028ec422ad473c11e164
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Have the text dumper do the same as all the others, instead of
ignoring unknown options.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I3c1dcbeda19e679be562110e44c5f566dfcc79ce
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Partly because it also saves to CBOR, but also because our guidelines
say to avoid using "Example" in the title.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Id858475a6b0474228cfe8044e188cc763f56e3a8
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Although used mostly in the same files, they're separate types, so
define them in separate places.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I9e64b382ad48f9a74e432ccd49b6f5fcc9316da3
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
The setup of the input and output converters is fairly complex but was
made harder to read by nearly-duplicating its logic for input and for
output. Break out into a separate function to make clear what parts
differ between the two and what parts don't. In the process, allow the
search for a named converter to continue past a match that doesn't
support the needed direction, on the off chance of a name collision.
Make an error message more articulate in the process.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I2a9de8b406c538098076f388fc8a1980b91fe16b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
It was previously possible to select an input-only converter for
output or an output-only converter for input. Also add a comment to
explain why failure to probe for the auto output converter isn't an
error, where failure to probe for the auto input converter is.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I17dfbbee7d8b5a9629e66d0e1a6a4014b01a7262
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
The old image wasted a log of space, was poorly legible and showed
little more than the cbordump example's illustration shows. Make
explicit that we get an initial CBOR file from savegame, show how it
can be converted to and from XML (idempotently) and still find space
to show the same thing as before. All more legibly and in a smaller
file.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ifc599d0dd646f136ccd2860ca927186d478b0fb9
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Specifically, prune it to fit on a single line.
Much of what it was saying was implicit in its context already.
It also neglected to mention CBOR's part in the story.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I161a345cbbea8b706490fcbbadecd01b8946af31
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
This lets us testFlag() instead of using raw bit-field operations.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I2c26e9a24728e81baa42cf14c75271a015460913
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Its methods act on their parameters without changing the converter, so
can all be const. Its instances thus have no non-const members to
exercise, so can always be const.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ifcdb2f2159c2cfcd7998dd118aa327a32d299ccf
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The two were in the same files but mostly unrelated to one another -
aside from the converter defaulting to the dumper for output.
Furthermore, the dumper actually uses QDebug and QTextStream, not
QDataStream; rename it to reflect this reality.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Id65c120c319b555039f7fd186ed262f35ff5260a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
I overrode clang-tidy where it uglified or obfuscated and did some
clean-up provoked or made possible by its changes. Konrad pointed out,
in review, a constructor that could be = default; it could, in fact,
vanish entirely as a result.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I9b7744a3abaa29e6f9e0689d0f6985bfd88cd0fd
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
A couple more compilation units could use Qt::StringLiterals. Prefer
QL1SV for the code constants, to keep code small. Convert fpToString()
to take QL1SV instead of const char *, with suffix empty by default.
Also rearranged some spacing, some if it suggested by clang-tidy.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I03d810d52afcd4a760d18f2553914b75af716b74
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Make a local variable more local, set a variable only once its new
value is known to be valid.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ib6aa16e8c834f89c6ccc0715f20b0e5f0a7f3b6d
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
The serialization converter example's text converter's loadFile() can
be made tidier by making the conditions within its loop into a chain.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ic82355eab7380a0c671b3805ca140958bb1c5af5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
It was added in 5.12 and we've had a few upates since then.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Iacb5368d4baa7d25f981bb0b8bd8d68b5461e17d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Marc disagreed with clang-format on some, which are thus excluded.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I1402274635dba866a8160a68211874cb11dcfa61
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Document previously-undocumented methods. Document in terms of what
each thing achieves, not how it does it. The U+00B7 is not the period,
it is the centred dot. Fix various anachronisms; the existing docs
were out of date with the actual code.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I17da880e0afd7260aa6f3b7bdddb430c437f4562
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
The treeWidget member of MainWindow could be initialized before the
body of the constructor, enabling it to be a *const variable.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: If4a3b04729bc7fa5859ca88183eec376f6992455
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
I'll be adding docs for parts currently lacking them; fix up the
numbering first, to disentangle from "real" changes to docs.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ia10f212626bf5ca9fab2b6ba6cf02dbd560a2f02
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Renumber the code fragments to match their order, while adding a
number for the previously undocumented custom method. Add a brief
description of it. Move the createMenus() part up to after it, combine
the createActions() with its (as createActions() is long gone, fused
into it and sharing its snippet number).
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: If0fbcadfa058fc12cbd74ba1897646113bd016b0
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
This will make the description of the type flow more naturally.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I751bdaf420be7afc9cb4925af4f2a94367840605
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
The old screenshot showed an old XBEL file's content, with trolltech
URLs. Update to match the new XBEL file's content.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Idacc31b7786b1e6ed1425857470b1d37227096cd
Reviewed-by: Kimmo Leppälä <kimmo.leppala@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Most links are now https, several have relocated, one entirely
rebranded. Same example in both QXmlStream and DOM forms.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ifbc58dadc834cf51113adb1c82de971a8768ee58
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
doc.qt.io was described as Qt 5 documentation; no need to version-limit it.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I1c5abe3d805c2b845a74b9fe454c494fa1eff4c7
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
A few examples seem to have copied and pasted a help action "About
&Qt" that triggered QCoreApplication::quit. This does not look like
best practice. Use QApplication::aboutQt instead.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I1887a3c999d752a24c7c4d3cabc4a5d63b29b966
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
It's really showing how to request a resource and act on its becoming
available. The use of XML to do so is incidental; the use of
networking is central.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ibcf438c7ef3b2464ddfa8b96a79fb15523e4a468
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
- Use mime types in the file dialog handling
- Use per class includes
- Use the configure system instead of QT_NO... defines
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Iea915604e89d3005270f0eb83eca882855589a44
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Create the fixed string once and reuse it. Also give a name to the
escape code that's its repeated character.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I3d6416070f1d5490ec137e251daff0e1637fb788
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Put readBookmark() first of the constituent parts, as it's the most
intelligible (albeit currently undocumented) and gives some clue to
the purpose of readTitle(), which is next.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I91d3d6bf8adc3f3001c90274bb62a9da6bf05362
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
The Qt Widgets Application example was moved to manual tests,
and no longer contains the snippet identifiers. Fix \snippet
and \quotefile commands to quote similar code snippets from
other examples or snippet files.
Fix also the following documentation warnings:
* No such parameter 'parsingMode' in QUrl::fromEncoded()
* Missing image: rsslisting.cpp
Pick-to: 6.6 6.5
Change-Id: Ibc989e83abc49837db08628facaf8e5f72b2f123
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Both the DOM and XML stream versions of the XBEL bookmarks example had
a frank.xbel in their EXAMPLE_FILES, but there is no such file. So
asking qmake to include it is spurious.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Iec08042d181fc09c2c428685ce841a13161ab273
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The XML stream reader and writer accept QAnyStringView arguments these
days, so passing a QLatin1StringView is entirely sufficient. This
makes static functions to provide access to unique QString instances
redundant. Linkers are allowed to uniquify the literals the "..."_L1
reference.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I7f37e97631e11683b9ddd3842fc6233547bed5ff
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Pass one function's return as a parameter to another directly.
Use a ternary expression rather than conditional initialization.
Use initializer-list construction instead of appending to an empty
QStringList; and inline the result where it's used.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I781aedba8dcc4251193b55d82fe684c9b5da241a
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
As readXBEL() does call readSeparator(nullptr), the latter should cope
with being passed nullptr as item.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I786e4438b566438448b5d54ff6442c27f1255aa8
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>