Commit Graph

23 Commits

Author SHA1 Message Date
Kai Köhne 16837bf1f1 Examples: Use Qt's canonical CamelCase headers
These are the names also given in the online documentation,
so let's use them in the examples.

Pick-to: 6.7
Change-Id: Ia10af880a0f2495094a5eb626b568da670e2848d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-01-10 10:23:01 +01:00
Ivan Solovev 6eb66322f0 Bluetooth Chat example: update UI
* Add some icons for Light and Dark themes. Implement switching between
  themes by listening to QStyleHints::colorSchemeChanged() signal and
  manually picking the proper icon.
* Rework the desing to get rid of the unnecessary "Quit" button, and
  also change the layout of buttons in the connection dialog.
* Update the screenshot in the documentation.

As a drive-by fix, make sure that the cursor is always at the end of
QTextEdit before showing a new message. The user can change the cursor
position by clicking/selecting the text, and this could previously lead
to some bugs in message visualization.

Fixes: QTBUG-118875
Pick-to: 6.6 6.5
Change-Id: Ia3a9dec3dae0d1411643ed851eba0ab4dc96a47f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2023-11-27 09:45:09 +01:00
Ivan Solovev 92bea4cac7 BtChat: adapt to using new QBluetoothPermission
Also add missing Info.plist files

Task-number: QTBUG-109964
Change-Id: Icf1fdf1353898538ce42a27cb0b0cb01c0823e26
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-04-05 10:01:02 +02:00
Ivan Solovev 7be77bb98e BtChat: fix a potential crash when deleting uninitialized pointer
Initialize ChatServer pointer to nullptr, and also remove an explicit
delete call, because the pointer will be managed by Qt.

Pick-to: 6.5
Change-Id: If1650a927e094a0b5349ecb6a8288531479ae1a5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-04-05 10:00:58 +02:00
Ivan Solovev 30bb640602 BtChat example: improve code
Improve the example code according to guidelines:
* fix CMakeLists.txt by using qt_standard_project_setup() and PRIVATE
  linking
* fix memory leak in Chat dialog
* fix includes
* fix forward declarations and do not use QT_USE_NAMESPACE
* use Qt::StringLiterals
* remove outdated warning for Windows platform
* split too long lines

Task-number: QTBUG-111972
Pick-to: 6.5 6.5.0
Change-Id: I81e472cfacf8c6adf97b31e97254797d40b01519
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-03-20 11:23:38 +01:00
Lucie Gérard 664d2a1cf0 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
License files are organized under LICENSES directory.

Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: Ifc22d8ae24532e9a1093ca613ed6590a1992bc39
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-06-10 15:13:12 +02:00
Juha Vuolle bb419a4c60 Remove unsupported Android bluetooth codepaths
Minimum Android level supported on Qt 6 is Android 6 / API Level 23.
This commit removes older unsupported code in order to simplify.

This concerns primarily:
- sdkVersion() checks
- Java reflections (API availability was uncertain)

Task-number: QTBUG-102497
Pick-to: 6.2 6.3
Change-Id: Ia90248a0a8f8e32130b8394998c2676c97a02eb5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2022-05-12 09:06:30 +03:00
Marc Mutz 4d975c3ffc Port simple cases of count() to size()
The count() methods on QByteArray and QString are deprecated. The ones
on other Qt containers will likely follow soon, so port them all to
size().

The changes which also require int -> qsizetype will come in a
follow-up patch.

Pick-to: 6.3
Change-Id: I23e364019b9cfc457d93f4a3bb4660fe8d790da8
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-04-11 15:21:46 +02:00
Ivan Solovev adcfc156f4 BtChat: fix crash when no adapter is found
The example was assuming that QBluetoothLocalDevice::allDevices() always
returns a non-empty list.
This is not true for the cases when desktop has no bluetooth adapters,
as well as for WinRT implementation (it always returns empty list for now).

This patch fixes the crash and provides some information messages to the
console. Note that WinRT implementation has an extended warning, because
it returns an empty list even if the adapter actually exists.

Fixes: QTBUG-98323
Pick-to: 6.2
Change-Id: Iaa81465cf6be2febf20526c11909667fd60728b3
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-11-16 09:58:31 +01:00
Ville Voutilainen 7d2c6ae66f Remove AndroidExtras dependencies and port to new Qt 6 Android APIs
Task-number: QTBUG-93811
Change-Id: Ia3eb9ad90f27614db5997e1f41f13e050f5f4ab7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-06-04 15:08:23 +03:00
Andreas Buhr 67c772e950 QtBluetooth examples: make server device discoverable
When trying the bluetooth examples on devices which do not know
each other, they do not find each other, because the have to be
paired first. This could lead to some frustration. This patch
sets the server device into discoverable mode first.

Change-Id: I2873f957d36a45cd86e282e274e198e560a243ad
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-02-22 17:59:28 +01:00
Andreas Buhr 764c1d056f Beautify btchat: Leave focus on text input on send message
With this patch, one can use btchat like every chat application:
Just type a message, press return, type the next message. Before,
it was necessary to move the focus to the text input again after each
message.

Change-Id: I534143340284477810c93bbeebabb5d02132a208
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-02-15 13:07:28 +01:00
Andreas Buhr d4f9117935 Beautify btchat example: print a newline after error messages
Change-Id: Ia13637a4fce69460423d0ca5afaebca62df5d085
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-02-15 13:07:09 +01:00
Oliver Wolff f1aea39b23 Clean up btchat example
- Replace old connect syntax
- Clean up includes
- Replace 0 with nullptr
- Add socket error handling

Change-Id: Id4c7634db29a23184d3ce2d92ffa39c71505de12
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2018-08-16 09:21:25 +00:00
Kai Koehne b171cddac0 Fix outdated BSD license header
Change-Id: I28f5936913a6127806325df34af4bf71a142e72e
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2017-10-17 11:17:54 +00:00
Alex Blasche cb1403c242 Adjust btchat example to Android UUID SDP discovery bug
Task-number: QTBUG-61392
Change-Id: Ia7d680a40b0fe359dfb5fe69ad9f3e83fe9ccb7d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-06-28 13:30:06 +00:00
Jani Heikkinen 7354c6d393 Update copyright headers
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.

Change-Id: I3822a6484e8f7a420330de1cb1aeb0c3d1cf41b7
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
2015-02-16 11:48:42 +00:00
Alex Blasche 8be9bf4cea New QML based Bt chat client
Change-Id: I235c54591dbbf04aa58c024093beca8c068b4aed
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
2014-09-30 14:04:54 +02:00
Alex Blasche 85de7d64e8 Fix peer to peer communication using two local adapters.
The code assumed to use the default adapter in a variety of places
which caused wrong SDP registrations, device searches and peer names.

The btchat examples was extended to cope with two local adapters. If there are
more than two local adapters they will be ignored.

Change-Id: I27d8bce65d943773e4e6cbd86982446fa79664a4
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
2013-09-25 10:37:27 +02:00
Fabian Bumberger d8d903826d Merge QRfcommServer and QL2capServer to QBluetoothServer
Task-number: QTBUG-32722

Change-Id: Ia75ad5af2f81b737a8cca09dba919a7dc0fa0f8a
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
2013-08-29 14:06:54 +02:00
Alex Blasche b0cca9bdd0 Remove code related to dead or currently unsupported platforms
- Removes the Meego/Maemo backend for QtNfc
- Remove Simulator, WinCE and S60 remnants from the examples

If any of these platforms becomes relevant they can be added back
of course.

Change-Id: I84712ea07f01794b622560ce77e08cee347406e3
Reviewed-by: Michael Zanetti <michael.zanetti@canonical.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Alex <alexander.blasche@digia.com>
2013-07-25 14:30:14 +02:00
Alex Blasche 8dad4698d9 Update Copyright headers
- Update Digia's copyright year
- Add copyright to files without it
- Convert old BSD to new LGPL license for auto test code

Change-Id: I47f5c871c436f9c2731b235026434448719cc671
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2013-06-25 10:08:54 +02:00
Jerome Pasion d8a179128c Qt Bluetooth: Modularized documentation
-moved documentation to src/bluetooth/doc
-added a qdocconf file for Qt Bluetooth
-fixed relative paths for snippets
-moved examples to examples/bluetooth

Change-Id: Id41bac50dca628400568d191f1c3ccfbaac790a1
Reviewed-by: Alex <ablasche@gmail.com>
2012-09-27 14:43:52 +02:00