Commit Graph

21 Commits

Author SHA1 Message Date
Kai Köhne cdf4314acc lightningviewer: Clear font handling
While 'SF Pro Display' is the macOS default font, it is not accessible
under this name even on macOS:

    qt.qpa.fonts: Populating font family aliases took 111 ms. Replace uses of missing font family "SF Pro Display" with one that exists to avoid this cost.

Remove the font, and rely on the default system font. While at it,
also remove other font properties that are in the default range.

Pick-to: 6.10
Fixes: QTBUG-138174
Change-Id: Ie1a75aee7c74386ae5db982e3ef878496e521e8c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2025-07-29 08:22:53 +02:00
Kai Köhne ed39f939d1 lightingviewer: Improve build system
Call the executable "lightingviewer", except on macOS, where
it is "Lightning Viewer". Call the top-level project
LightingViewer.

Remove the project setup in the included CMakeLists.txt
files; they are not separate projects on their own in a
meaningful way.

Pick-to: 6.10
Change-Id: I05db4a318f2667a8ed41c943594310a49000cc11
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2025-07-08 16:28:20 +02:00
Andreas Eliasson 42cab48b04 Doc: Add tags to Lightning Viewer example
Fixes: QTBUG-135289
Pick-to: 6.9 6.8
Change-Id: I61dd5ee949f97917d65bfccf536a15cfa0a4a353
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2025-04-02 18:34:38 +02:00
Alexandru Croitor 4fc0afc2b4 CMake: Alternative fix of deployment for lightningviewer example
qmlimportscanner is used to scan the qml files, to decide which
plugins and libraries to deploy. Because none of the qml files
explicitly reference the LightningViewer or LightningViewerStyle
imports, it never deploys the qml modules, nor their dependencies.

This change adds a Deployment.qml file to the sources, which is not
actually used at runtime, but because qmlimportscanner sees it, due to
scanning the whole project directory, it will deploy the necessary
files.

Pick-to: 6.7 6.8
Fixes: QTBUG-127835
Task-number: QTBUG-128225
Change-Id: Ic5185d723d3a1f65427af1ee7799fa49ea414cfd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io>
2024-08-20 13:28:51 +00:00
MohammadHossein Qanbari 84e962eae5 LightningViewer Example: add 'import QtQuick.Control.impl'
There was a missing import. The 'QtQuick.Controls.impl' is required to
be imported when instantiating IconLabel.
Missing this import makes the example fail to run as the IconLabel type
is not known.

Change-Id: I1bc2baa150678d7398fdff5f9a5d867c73113277
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
2024-05-14 08:57:46 +00:00
Alexandru Croitor cde9cfb96c CMake: Add deployment API to our examples
Projects were modified using the tool at:
https://git.qt.io/alcroito/cmake_refactor

Some examples had to be adapted manually, mostly those that build
additional qml modules / plugins.

documentviewer did not get the deployment api, because it's trickier.

Pick-to: 6.7
Task-number: QTBUG-101340
Task-number: QTBUG-102056
Task-number: QTBUG-102057
Change-Id: I76322185fc824c112d77e077ee39e7ccbc193a4c
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-05-13 09:44:04 +02:00
Lucie Gérard 8b36425fab Correct build system file license under example
According to QUIP-18 [1] all files under examples
should be licensed
LicenseRef-Qt-Commercial OR BSD-3-Clause

[1]: https://contribute.qt-project.org/quips/18

Pick-to: 6.7 6.7.0
Task-number: QTBUG-121787
Change-Id: Ia2e8f62af64a384196a9b0c02ac5b2fbf5404a8b
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2024-03-19 08:20:16 +01:00
Lars Sutterud 4c3ea1b6eb Lightning Viewer: Update docs to clearly state use of simulated data
Due to the lack of an agreement with the lightning strike data provider,
we will only provide simulated lightning strike data for this demo. This
change removes info in the documentation about the option to forward
real world lightning data, and makes it more clear that the data is
simulated.

Fixes: QTBUG-122907
Pick-to: 6.7
Change-Id: Ibae18922e79393564b3947d813b1285f0358aaf9
Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-03-18 08:14:57 +01:00
Kai Köhne 69352e0b68 Lightning viewer: Fix typos
Pick-to: 6.7
Change-Id: I4d59da719d300b94571debe246e4969d6ea51c17
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-03-04 08:59:47 +01:00
MohammadHossein Qanbari c5fe729e0c Lightning Viewer Example: Remove Qt5Compat Dependency
The ColorOverlay is replaced with IconLabel to remove the dependency on
Qt5Compat.GraphicalEffects.

Fixes: QTBUG-121929
Pick-to: 6.7
Change-Id: I7dc6fd6538a2a1dd3c1e20a4dd401137a9e1030a
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-02-07 11:15:31 +01:00
MohammadHossein Qanbari 6cc0edc108 Lightning Viewer Example: Support LocationPermission
If the permission is granted, the user location will be visible and the
map view can be recentered.
Otherwise, if the user has already denied the permission and triggers
any action that needs the permission, a message dialog will notify the
user that the application needs the location permission, and the
permission is needed to be granted and the application needs to be
restarted.

Additionally, the PositionSource is not active when the permission is
not granted, and the distance and time layer is not able to show the
information until the user allows the application to use the location.

The user's location will be set from QML by PositionSource, then there
is no need to keep the QGeoPositionInfoSource object.

Task-number: QTBUG-121412
Task-number: QTBUG-121123
Pick-to: 6.7
Change-Id: I78856f8cc8d182aa7b02c1ffaba01a8871e0a0c6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-02-01 14:15:21 +01:00
MohammadHossein Qanbari c4f90b3df7 Lightning Viewer Example: Add OpenSSL for Android
The android_openssl libraries included.
reference: https://doc.qt.io/qt-6/android-openssl-support.html

Task-number: QTBUG-121123
Pick-to: 6.7
Change-Id: Icf21b4768d74cafe6b9a93e4e18fd4da780bdf14
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2024-01-26 15:45:05 +01:00
MohammadHossein Qanbari 0f8bf79538 Lightning Viewer Example: Use QML Module and Restructure Project Files
Restructure resource file management by relocating QML and asset files
from the resource files (qrc) to their respective modules within the
application. Moreover, the project has been divided into two distinct
submodules: LightningViewer and LightningViewerStyle.

The LightningViewer module includes the project's sources, QML files,
and assets, used for the model, view, and controller aspects.

On the other hand, the LightningViewerStyle module is dedicated to
defining a custom style generated by a tool. The purpose of separating
style-related files from LightningViewer is to simplify updates by
allowing the style generator tool to only modify contents within the
style subdirectory.

Task-number: QTBUG-121123
Pick-to: 6.7
Change-Id: Ib04fb156bd47b4033526c8eb9b33ccab76ab50e9
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2024-01-26 14:21:19 +01:00
Samuli Piippo 22315147d0 CMake: fix installation of demos projects
Projects need install instructions to be usable on embedded platforms.
Fix existing instructions to put files into correct places.

Fixes: QTBUG-112024
Pick-to: 6.7
Change-Id: I6a3d84edc1c67281d5497e99144c159faf0f783c
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
2024-01-25 15:13:29 +02:00
MohammadHossein Qanbari 103e54fe5e Lightning Viewer Example: Improve Updating Distance/Time
There was no need to waste time for calculating the distance and time
of the last strike. The calculation should be considered when there's a
need for it, e.g. when the distance/time layer is visible.

Task-number: QTBUG-121123
Pick-to: 6.7
Change-Id: Ib841502baa5138c91730a308194c6485a28fca1a
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2024-01-19 11:09:25 +01:00
Kai Köhne 9a61a3a987 Demos: Add dependency info to example metadata
Add metadata about build time / runtime dependencies in the form
of Qt documentation modules. This should allow Qt Creator to hide
examples where needed Qt modules are not installed (because they
are optional in the Qt Online Installer).

Pick-to: 6.7
Task-number: QTBUG-120759
Change-Id: I03d8d75b273fe497803b9af9783b90e397b0638d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2024-01-19 10:26:22 +01:00
MohammadHossein Qanbari 3a8e89543c Lightning Viewer Example: Wrong Last Strike Info on User Location Change
Fix a bug in the information of the last strike on the change of the
user's location.

Fixes: QTBUG-121043
Pick-to: 6.7
Change-Id: I2b9af6ad3246e58075ac60ce486299e4b7a62b4e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-01-17 18:56:11 +01:00
MohammadHossein Qanbari e7aa32c8fb Lightning Viewer Example: Avoid Using Heap Memory When Is Not Necessary
Remove the implementation of copy/move constructors/assignments to
follow the rule of zero/five (LastStrikeInfo).

Use std::unique_ptr instead of QScopedPointer.

Remove the copy/move constructors and assignments of some classes
because they are not copyable/movable.

Prefer stack memory over heap memory whenever possible.

Fixes: QTBUG-121018
Pick-to: 6.7
Change-Id: Ie8784a49beeb23d4ccbf4c18a3158ab7b25b5c5b
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2024-01-17 14:26:40 +01:00
MohammadHossein Qanbari c1962e9196 Lightning Viewer Example: Use chrono for Time Duration + Fix Bug
chrono::duration is used for time duration from the last strike.
Also there was a bug in calculation of the display text of time duration
in DistanceTimeLayer.qml that is fixed in this commit.

Fixes: QTBUG-121011
Fixes: QTBUG-121012
Pick-to: 6.7
Change-Id: I55f253bc7821328762cbff957eb9125c441bca2b
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2024-01-16 09:36:06 +01:00
MohammadHossein Qanbari 3f9efa6140 Lightning Viewer Example: Replace QSharedPointer with LightningItemData
The usage of QSharedPointer is replaced with the LightningItemData as
a value type to avoid heap memory allocation. Using stack-memory is
more efficient than heap-memory allocation for the high-speed arrival
of new lightning data.

Task-number: QTBUG-116750
Pick-to: 6.7
Change-Id: Ica837f5f3c5f24980bb597307c408aaffe3fbd02
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2024-01-10 16:02:48 +01:00
MohammadHossein Qanbari 60cf689c6a Examples: Add LightningViewer (V1)
Implemented lightning viewer example using a web socket connection to
an AWS gateway for real-time lightning data visualization worldwide.
Supports both landscape and portrait modes for optimal screen
presentation. Added diverse map layers, including live data and
distance-time layers. Added functionality to toggle between different
map types. The lv_style is auto-generated using figma-style-generator
tool based on specified design requirements (see the task description
and comments for more details).

Fixes: QTBUG-116750
Pick-to: 6.7
Change-Id: I2507c9b030cb0c91d1a7cf51267770735a35419b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-12-23 00:07:03 +01:00