summaryrefslogtreecommitdiffstats
path: root/examples/network
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Add deployment API to our examplesAlexandru Croitor2024-03-2218-162/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Projects were modified using the tool at: https://git.qt.io/alcroito/cmake_refactor A couple of examples had to be adapted manually, due to them including more than one app per example subdirectory. The INSTALL_EXAMPLESDIR and INSTALL_EXAMPLEDIR assignments were removed. The install(TARGETS) calls were modified according to our documentation snippets for qt_generate_deploy_app_script. A qt_generate_deploy_app_script call was added for each executable target. Note that the deployment step will be skipped in the CI for now, because we enable QT_DEPLOY_MINIMAL_EXAMPLES and thus QT_INTERNAL_SKIP_DEPLOYMENT, and also because standalone examples are not enabled yet, and deployment is disabled for in-tree (so no-standalone-example) prefix builds. The install(TARGETS) calls for each example will still run, installing the examples into an installed_examples directory, that will not be archived by the CI. Pick-to: 6.7 Task-number: QTBUG-102056 Task-number: QTBUG-102057 Change-Id: Ida389bbad41710b2ae5da4d95e2d85be9e0cd9ce Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Correct license for examples filesLucie Gérard2024-03-0719-19/+19
| | | | | | | | | | | | | | Example takes precedent over build system file type. According to QUIP-18 [1], all examples file should be LicenseRef-Qt-Commercial OR BSD-3-Clause [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: Id348a89884bb309b96abb31077f14a51086b5d0c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Remove extra semi-colonsTasuku Suzuki2024-02-061-1/+1
| | | | | Change-Id: I92fddb36cd136fd1bd627955f15d0559b9942d7e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Update icons in the torrent exampleMatthias Rauter2023-12-1826-36/+144
| | | | | | Fixes: QTBUG-118876 Change-Id: I7b3c24db220a0501bc2b99341589211bdf217c05 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Match descriptive text with code snippetAndreas Eliasson2023-12-012-2/+2
| | | | | | | | | | | | The code snippet reads QDataStream::Qt_6_5. Change the post-descriptive text to match this. Fixes: QTBUG-118907 Pick-to: 6.6 6.5 Change-Id: I3b3d03e9095a6ba6febfb652b3bc7173ed4ccfa4 Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Doc: Add HTTP Client example also to Web Technologies categoryKai Köhne2023-11-061-0/+1
| | | | | | | | | | | HTTP belongs to Networking, but also fits well with the scope of Web Technologies - qtnetworkserver is there after all, too. So just add the example to both. Pick-to: 6.6 6.6.0 Change-Id: I588e4e0eefc92ba396fbb21d6f55b33f68332a74 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Preparations to deprecate QItemDelegateChristian Ehrlicher2023-10-051-3/+3
| | | | | | | | | | | | | QItemDelegate was superseded since Qt4 by QStyledItemDelegate but it took until Qt6.7 to remove the last occurrences in qtbase. - remove unused includes / replace with qabstractitemdelegate.h - replace references in the documentation with QStyledItemDelegate - adjust the examples and tests to use QStyledItemDelegate Pick-to: 6.5 6.6 Change-Id: I246755004ce2d01192a726ca0972106c237df0cc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Move rsslisting documentation to common dirKai Köhne2023-09-212-0/+0
| | | | | | | | | | Move the rsslisting example documentation to examples/network/doc, as it is done for all the other examples. Fixes: QTBUG-117215 Pick-to: 6.5 6.6 Change-Id: If83202825afe8c69cb7fda0f84ca4832cf3d60e7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Fix qdoc full stop warning in briefsAndreas Eliasson2023-09-052-2/+2
| | | | | | | | | | | | Add a full stop to the briefs to clear the following qdoc warnings: * multistreamclient.qdoc: '\brief' statement does not end with a full stop. * multistreamserver.qdoc: '\brief' statement does not end with a full stop. Change-Id: If0e58bc100a595f3ee00c79c31ac19f8d9ee3ad9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Exclude some examples from Android buildElias Hautala2023-08-282-1/+5
| | | | | | | | | | | | Excludes dnslookup, waitconditions, semaphores, cbordump, savegame, convert, pingpong and complexpingpong examples from Android build because of missing Qui and Quick dependenies. Task-number: QTBUG-111933 Pick-to: 6.5 6.6 Change-Id: Ied01f62ee61a9220dcb44c13fda46f6a5e158293 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Multi-stream* example: add simple docsMårten Nordheim2023-08-174-0/+31
| | | | | | | | To make it show up in the documentation. It's also our only example showing SCTP. Change-Id: Ib80ab869d9a6cbd370aa1a0c74772639e4393b37 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Doc: Add example categories for Qt Network examplesMats Honkamaa2023-08-163-0/+3
| | | | | | | Task-number: QTBUG-116001 Pick-to: 6.5 6.6 Change-Id: I0c32df7752347f7c38996b3815d270dbd4c90707 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Network-chat example: update the screenshotMårten Nordheim2023-07-173-1/+1
| | | | | Change-Id: Ibdb9e242295766304c1c7a551d831fb796518496 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Network-chat example: Use QHash for peersMårten Nordheim2023-07-172-7/+7
| | | | | | | | | | | | | | | | We don't key it on IP address anymore so we can drop the use of QMultiHash. This also requires moving the connections for error and disconnected to readyForUse so we don't remove an active connection when a second connection attempt happens from the same peer process. But since we still need to deallocate those connection attempts if they error out or simply disconnect, we connect their signals to the QObject::deleteLater slot. In some cases we might call deleteLater twice but that's fine. Change-Id: I48c27de1e51a52ef61cfb941a7a81b358ae9ce3f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* Network-chat: Fix remote peer making multiple connectionsMårten Nordheim2023-07-176-39/+77
| | | | | | | | | | | | | | | | The system was just treating IP (and optionally port) as a unique identifier, so if a peer had multiple possible paths to a client they would connect multiple times. This fixes that by generating using QUuid in each client. We then use this during broadcast, replacing the username we sent before (which was not used), and as part of the greeting. The greeting now is more complex, since we need to send both username and the ID. Change-Id: I6c6c2ffd5198406aad48445a68dd6aab36de69c0 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* broadcast{receiver,sender}: update meta infoMårten Nordheim2023-07-122-2/+6
| | | | | Change-Id: I864de05a766fa4e5b9b7fdec7c2b95ac2b576c26 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* DnsLookup: add some documentationMårten Nordheim2023-07-122-0/+17
| | | | | | | Just to make it show up in the docs. Change-Id: I22e9a1eb7dd040e76ee68f3f63053b030733b33d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* securesocketclient: Update meta infoMårten Nordheim2023-07-121-1/+3
| | | | | | Change-Id: I34b11cd73c80dc3033de8731bd8edc0db3ed4a12 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* securesocketclient: Replace the screenshotMårten Nordheim2023-07-124-2/+1
| | | | | | Change-Id: I73658fef13ac4fdc046011f6aa68b6f97555546a Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* securesocketclient: Replace QLatin1Char with char16_t literalMårten Nordheim2023-07-121-12/+12
| | | | | | Change-Id: I3efebe12e3a46c35e6c1775226e9ba424811cc30 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* Network-chat example: Remove unused constantMårten Nordheim2023-06-221-2/+0
| | | | | | Change-Id: I29768a38136af026c8613a47adea390f11ff46a9 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Network-chat example: Only disconnect if still connectedMårten Nordheim2023-06-221-1/+1
| | | | | | | | | If we are already disconnected we end up printing warnings about how it's illegal to call waitForBytesWritten on an unconnected socket Change-Id: I8c864d105d5372edfee84affb362cca3021b8ea0 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: RSS listing example: Fix file quotingTopi Reinio2023-06-151-7/+7
| | | | | | | | | | | | The example was moved to qtnetwork but its documentation still referred to old paths under /examples/corelib. Add documentation dependency to qtwidgets as RSS listing example's docs link to a number of widget classes. Pick-to: 6.6 6.5 Change-Id: Ief1c9dc2ca38ba3da1fe3039500292147ec4cc7d Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
* Move RSS listing example to networkingEdward Welbourne2023-06-149-8/+378
| | | | | | | | | | | 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>
* Examples: Remove unnecessary Q_INIT_RESOURCE callsKai Köhne2023-06-082-4/+0
| | | | | | | | | | | Explicit calls to Q_INIT_RESOURCE are only needed for resources embedded in static libraries. See also https://doc.qt.io/qt-6/resources.html#explicit-loading-and-unloading-of-embedded-resources Pick-to: 6.5 6.6 Change-Id: I06a24d1c04369eedc78ca60a6ca02ce33907d9e7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix deprecation warnings agains u"..."_qs in dnslookup.cppEdward Welbourne2023-06-071-5/+5
| | | | | | Pick-to: 6.5 6.6 Change-Id: I29a177c7d46304c5b494218f5862195eb92c7684 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Network chat: Update example meta infoMårten Nordheim2023-05-311-1/+3
| | | | | | | Task-number: QTBUG-108873 Change-Id: I46a412beb406cf66daf552adbef165dc246dadc2 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* Network chat: style fixesMårten Nordheim2023-05-312-4/+2
| | | | | | | | | | | The if statements were originally broken to fit 80-column width but didn't have the braces we typically require. It anyway fits inside our new 100-column width, so just do that. Task-number: QTBUG-108873 Change-Id: Ib632f35607e6b716141c4c5d8211de7a0745c6ab Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Network chat: simplify lookup functionMårten Nordheim2023-05-311-5/+1
| | | | | | | Task-number: QTBUG-108873 Change-Id: I3ca0c976236003c708130ed120dba14cfbbf8185 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Network chat: when removing an entry in multihash, specify which oneMårten Nordheim2023-05-311-1/+1
| | | | | | | | | | | | | | | | Using only the key means all clients with that IP address are removed. But there could be multiple clients running on the same multi-user system. So, use the value as well to remove just the specific one. This also fixes a bug where, when a client disconnects, all of the connections are removed from the client's map, but only _one_ is removed from the GUI. Task-number: QTBUG-108873 Change-Id: I87da862e8f337fd9c246ff5a2d243e514076fa5f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* Network chat: avoid double lookups into hashMårten Nordheim2023-05-311-8/+11
| | | | | | | Task-number: QTBUG-108873 Change-Id: Iafa5a7a1ec99d2414f175f2d30fe03a90c6716f3 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Network chat: Use QStringBuilderMårten Nordheim2023-05-312-0/+5
| | | | | | | | | It is a best practice after all Task-number: QTBUG-108873 Change-Id: I11c23c080f6fe7f124e461affa88279d5def93f9 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Network chat: make ctors explicitMårten Nordheim2023-05-314-5/+5
| | | | | | | Task-number: QTBUG-108873 Change-Id: I08cd676aeb732d32b4d1e7d13a0aa1b37a46283f Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Network chat: default-initialize or direct-initialize membersMårten Nordheim2023-05-315-19/+10
| | | | | | | | | Where possible Task-number: QTBUG-108873 Change-Id: I8125ffd63cd0ad1970575fb1a6b85021c03c38d5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* Network chat: update includesMårten Nordheim2023-05-317-14/+14
| | | | | | | | | Prefer own headers, avoid full-module includes Task-number: QTBUG-108873 Change-Id: I4282d4aab5fd66c64fc27cd130b223d33069d80f Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Torrent example: update usage of integer typesMårten Nordheim2023-04-116-63/+64
| | | | | | | | | | | | Some of the 'int's are purposefully 32-bit because that's what the protocol is, but others aren't. So, be more explicit. Task-number: QTBUG-110622 Pick-to: 6.5 Change-Id: I338abca1f13b0c95f49a6f52933712f43f147590 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Doc: Use the \examplecategory macro to tag examplesTopi Reinio2023-04-117-7/+7
| | | | | | | | | | | | | | | | The '\meta category' command was used for tagging examples with a specific category, used in Qt Creators Welcome mode. As we want to also generate lists of examples belonging to a category elsewhere in the documentation, replace the command with a macro that expands to the original \meta command and also adds the example to a group using the \ingroup command. This way, the category names can be used as arguments to the \generatelist or \annotatedlist commands. Pick-to: 6.5 Task-number: QTBUG-112731 Change-Id: I46762dabc5f718fecc09a3533235eaa911dda5a0 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Remove loopback network exampleMårten Nordheim2023-03-239-283/+0
| | | | | | | | | | It doesn't showcase anything interesting that other examples don't already show off. Pick-to: 6.5 Change-Id: Ie95c3ddb3ff52b3beab54bd6fa75fb75ae5c7ba5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* Clean up multicast examplesMårten Nordheim2023-03-237-6/+10
| | | | | | | | | They're small, not much to polish. Pick-to: 6.5 Change-Id: Iada573504de557ab18381370bb9760b1f60cc2e4 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* HTTP example: update screenshotMårten Nordheim2023-03-023-1/+1
| | | | | | | | Fixes: QTBUG-108874 Pick-to: 6.5 Change-Id: Ib87895c6512abb967734ce4c1ed0be76c698feb4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* DNS Lookup: Use ideomatic cstdio includeMårten Nordheim2023-03-021-19/+21
| | | | | | | | | Task-number: QTBUG-108873 Pick-to: 6.5 Change-Id: I646f0c985adc45a17103b5f98394f3def4b6ada2 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* DNS Lookup: Change local function to return struct instead of enumMårten Nordheim2023-03-021-36/+38
| | | | | | | | | | This let's us get rid of an out-parameter. Task-number: QTBUG-108873 Pick-to: 6.5 Change-Id: Ifc08d3905932f28ecdfdf3a7de1499700cc7e606 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* DNS Lookup: Use standard functions to print version/helpMårten Nordheim2023-03-021-4/+3
| | | | | | | | | | showHelp was already in use, but not showVersion. Return 0 in both cases, even if it's unreachable. Task-number: QTBUG-108873 Pick-to: 6.5 Change-Id: Iba820e89d7de066130163e7829f75bbfcfa3f7dd Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* DNS Lookup: reflow some code to avoid exceeding column limitMårten Nordheim2023-03-021-15/+31
| | | | | | | Task-number: QTBUG-108873 Pick-to: 6.5 Change-Id: Ic17ded256152f7d89bd200ea0e163f2b8f1ea70a Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* DNS Lookup: Use std::optional instead of casting enum to intMårten Nordheim2023-03-021-5/+5
| | | | | | | Task-number: QTBUG-108873 Pick-to: 6.5 Change-Id: I0bd5dc004154c1c4026be2feb6187c53e5e77801 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* DNS Lookup: Avoid unneeded allocations in parsing functionMårten Nordheim2023-03-021-11/+11
| | | | | | | | | | | By using .compare(~~~, Qt::CaseInsensitive) instead of .toLower() Task-number: QTBUG-108873 Pick-to: 6.5 Change-Id: I60e1fdc0a54450e7385e90f84fd509e62b82d2c9 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Delete the Network Download (Manager)? examplesMårten Nordheim2023-03-0214-622/+0
| | | | | | | | | | | | | | | | | | | | Their use of QtNetwork is already covered by the HTTP example. While showcasing that QNAM easily deals with multiple simultaneous requests, waiting until finished() is emitted to write anything is not exactly idiomatic. And managing your own queue to only have one request running at a time is a weird example for an asynchronous framework. In this regard, having an example for a complete download manager (with a GUI) would be interesting, but may ultimately be very time-consuming to make for limited gain. Task-number: QTBUG-110643 Pick-to: 6.5 Change-Id: I6b2c1546b85fa89ab7ce1ff5565b0293b5710b74 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* Doc: fix links to renamed network examplesVolker Hilsheimer2023-03-014-7/+6
| | | | | | Pick-to: 6.5 Change-Id: I8790bb660070a092e268294b5640c6d5af41deb0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fortune* Example: update screenshotsMårten Nordheim2023-02-284-0/+0
| | | | | | | Fixes: QTBUG-108875 Pick-to: 6.5 Change-Id: Ib57482959973815681b0b178acea3634a4f63220 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Torrent example: Fix use-after-free crashMårten Nordheim2023-02-211-0/+4
| | | | | | | | | | | | The crash would sometimes happen shortly after removing a torrent since the RateController would still try to use it even though it had been deallocated. Pick-to: 6.5 Task-number: QTBUG-110622 Change-Id: Icad1531ea58560a3a3157a3ed8c0e6b283573196 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>