Commit Graph

172 Commits

Author SHA1 Message Date
Eike Ziller
08bbe885b4 Examples: Support manifest-defined category order
Reads a separate sorted list of categories from the manifest files.
The first of these lists that is found in the manifest files is used.
For example the Qt documentation defines the list in the manifest file
for qtdoc.

Change-Id: I57c2779862a5ebfc27707b53d43d4ed9e7e8c5f9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-07-24 11:02:18 +00:00
Eike Ziller
31312dc23e Examples: Re-add categories for sorting
that got accidentally lost while merging 11.0
because the code moved

Change-Id: I786d89f0909ccf5f3159a734b1d10d78e96904c5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-07-20 12:35:32 +00:00
Eike Ziller
c43a2ee1c4 Use categories for Tutorials page
Instead of adding the category into the title with "Help: ..." etc, use
the actual categorized view that we already use for examples and
marketplace. Set the corresponding meta data in the manifest file and
read it also for tutorials.

Change-Id: Id9081518c1c0afee8d080af3ca8a5dca5cdde775
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-07-14 09:33:03 +00:00
Eike Ziller
90a6faed4e Merge remote-tracking branch 'origin/10.0' into 11.0
Conflicts:
	src/plugins/qtsupport/exampleslistmodel.cpp

Change-Id: Idbe0117ce810b4ab180a7c4f9b7b35c9c4b988e5
2023-05-25 15:49:57 +02:00
Eike Ziller
8ca4f909e8 Examples: Move categorization to examplesparser
For easier testing.

Change-Id: I11f9de3f4fbcc2c85c196f1b59b2147e73ea8209
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-25 08:43:49 +00:00
Eike Ziller
07934fadcf Examples: Use Qt logging instead of environment variable
Use logging category qtc.examples instead of a custom
QTC_DEBUG_EXAMPLESMODEL environment variable.

Change-Id: Idbd6d4b29dbd7b9e8c5976eca6efeb232bf7fa5f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-05-22 07:42:13 +00:00
Alessandro Portale
765e8a65ea Examples: Centralize constants in one place
Having all constants in WelcomePageHelpers makes reading the welcome
scren code a bit less interesting.

Change-Id: Idc2e402f33042b49d041c43ecc78a6e8d2d3536a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-05-03 19:55:22 +00:00
Eike Ziller
4e6877753a Merge remote-tracking branch 'origin/10.0'
Conflicts:
	src/plugins/android/androidrunnerworker.cpp
	src/plugins/qtsupport/exampleslistmodel.cpp

Change-Id: I1628528dbc0ffe874b49bbe022da5933b1348057
2023-04-18 12:53:45 +02:00
Eike Ziller
bdfa412b14 Examples: Automatically enable showing categories for Qt >= 6.5.1
Supposedly that is the version that will have a sensible amount of
examples sorted into categories to not look weird.

It is still possible to force showing the categories with
QTC_USE_EXAMPLE_CATEGORIES.

Fixes: QTCREATORBUG-28546
Change-Id: Ia1e6afa97d9b1b86763c29209fcf6f674d0844f5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-17 09:13:56 +00:00
Eike Ziller
9650a2bded Examples: Limit categories to single row and allow showing all
Limit the items shown for categories to a single row (two rows for first,
"featured" category), and add a "Show All" link/button in the heading,
that shows all items in that category only (with a "Back" button).

The "Search in Examples" input ignores categories.

Change-Id: I7c8561a306ad86c3b537587621d3fd030cd08af8
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-04-13 13:05:32 +00:00
Eike Ziller
e6414d9941 Examples: Optionally parse categories from meta data
Optionally parses example categories from the examples manifests, when
setting the environment variable QTC_USE_EXAMPLE_CATEGORIES (can be done
in Qt Creator's Environment > System > Environment settings).
It doesn't make sense to unconditionally enable that yet, because only
few examples actually have categories so far, so we will need to wait
until some Qt version is suited for enabling this.

If an example set does not provide categories, the "highlighted"
property is used to provide a "Featured" category, as before.

If an example set does provide categories, these are shown instead,
sorted alphabetically, and examples with the "highlighted" property
are put at the front of the category, overriding the otherwise
alphabetical listing inside the categories. Examples without a
category are put into a separate "Other" category at the end.

Task-number: QTCREATORBUG-28546
Change-Id: I7ca312686eae13e16961def1b4b36ffd7050a447
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
(cherry picked from commit a2de016f64)
2023-04-13 07:14:31 +00:00
Eike Ziller
ac17e0e2ad Convert Examples model to FilePath
Change-Id: I56219d2f9516662b32d45fd9b2108a0ad34113cc
Reviewed-by: David Schulz <david.schulz@qt.io>
(cherry picked from commit 255afd45bf)
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-04-13 07:13:50 +00:00
Eike Ziller
584874f15f Move examples manifest parser in separate function
and file. To make it auto-testable.

Change-Id: I19d263bf080a0089eb9a4ec0f379c52446771c0a
Reviewed-by: David Schulz <david.schulz@qt.io>
(cherry picked from commit 7e75097447)
Reviewed-by: hjk <hjk@qt.io>
2023-04-11 11:56:42 +00:00
Eike Ziller
a2de016f64 Examples: Optionally parse categories from meta data
Optionally parses example categories from the examples manifests, when
setting the environment variable QTC_USE_EXAMPLE_CATEGORIES (can be done
in Qt Creator's Environment > System > Environment settings).
It doesn't make sense to unconditionally enable that yet, because only
few examples actually have categories so far, so we will need to wait
until some Qt version is suited for enabling this.

If an example set does not provide categories, the "highlighted"
property is used to provide a "Featured" category, as before.

If an example set does provide categories, these are shown instead,
sorted alphabetically, and examples with the "highlighted" property
are put at the front of the category, overriding the otherwise
alphabetical listing inside the categories. Examples without a
category are put into a separate "Other" category at the end.

Task-number: QTCREATORBUG-28546
Change-Id: I7ca312686eae13e16961def1b4b36ffd7050a447
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-03-16 13:50:06 +00:00
Eike Ziller
255afd45bf Convert Examples model to FilePath
Change-Id: I56219d2f9516662b32d45fd9b2108a0ad34113cc
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-02-23 11:10:10 +00:00
Eike Ziller
7e75097447 Move examples manifest parser in separate function
and file. To make it auto-testable.

Change-Id: I19d263bf080a0089eb9a4ec0f379c52446771c0a
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-02-23 10:36:47 +00:00
Orgad Shaneh
b95fee74bb QtSupport: Fix potential null dereference
Shouldn't happen in real life, but done to make Coverity happier.

Change-Id: I3316030f59ec74516d2271973ac53c41554c3893
Reviewed-by: hjk <hjk@qt.io>
2023-01-23 07:58:32 +00:00
Eike Ziller
4d71a24cb9 Welcome/Qt: Show featured examples in separate section
Task-number: QTCREATORBUG-28546
Change-Id: I9cf42cd11b442f720070c250da789d23001a1375
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-18 10:17:11 +00:00
Eike Ziller
ad643fdd30 Welcome/Qt: Use separate model instances for examples and tutorials
And get rid of the need to filter the model in a special way.

Change-Id: I42dd80e3b8b122dcd2d5f454d0acde1facf556bd
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-18 10:17:03 +00:00
Eike Ziller
6c6277bc7d ExamplesListModel: Remove direct access of model items variable
Change-Id: I8dc2833f61fe0267953acfa8746151cea893c7f3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-18 10:16:46 +00:00
Eike Ziller
aff6c4b2d2 Welcome: Remove requirement for subclassing ListModel
By using aggregation for the pixmap fetching.

Change-Id: I6647cc6fa7995581c692050af32e41ba9aa86491
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-18 08:42:16 +00:00
Eike Ziller
514a62b9b2 ExamplesListModel: Remove unneeded override of data(...)
It seems to have been a workaround for taking tags into account for the
filtering, but that is done completely different nowadays, and not with
the DisplayRole.

Change-Id: Iff73c1a33de4a40c4919794a8644fdc4af710ba1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-16 10:43:46 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Jarek Kobus
6a20c52cc9 QtSupport: Replace foreach with range-based for loops
Change-Id: Ia941c8dec41a73ca126c91304223d1fe98bc2972
Reviewed-by: hjk <hjk@qt.io>
2022-11-24 16:02:28 +00:00
Eike Ziller
5ae23f8c66 Merge remote-tracking branch 'origin/8.0'
Conflicts:
	.github/workflows/build_cmake.yml
	src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp
	src/plugins/qmldesigner/components/materialeditor/materialeditorview.h
	src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
	src/plugins/qmldesigner/designercore/model/model.cpp

Change-Id: I111b9140375b894a5487cc012b17cc32100bdb8d
2022-09-13 11:15:16 +02:00
Eike Ziller
d3a245574e Qt Examples: Fix that supported device information was not updated
When the user selects a different example set / Qt version from the drop
down, we must in all cases update the cached "supported device type",
which is later used to e.g. filter out all non-Android examples when
selecting an Android Qt version. We only did that in case the selected
example set was backed internally by a QtVersion pointer, but there are
example sets where that isn't the case.

The issue is reproducible by e.g. installing Qt 5.15 for Android and Qt
6.3 for multiple platforms. For the latter we only show a single entry
in the drop down, and do not have a single QtVersion pointer as a
backing. When switching the drop down from Qt 5.15 Android to Qt 6.3,
only examples with the "android" tag are shown, even though our Qt 6.3
installation supports more than that.

If we don't have a QtVersion pointer we now assume that everything is
supported.

Fixes: QTCREATORBUG-27017
Change-Id: I7a7666c3cfec098d85cfcbb0062c63395af6d0c0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-09-02 12:22:50 +00:00
Eike Ziller
904c368858 Projects: Use qtcEnvironmentVariable* instead of qEnvironmentVariable*
And instead of qgetenv.
Takes Qt Creator's setting at "Environment > System > Environment" into
account, which makes it easier on some platforms to set them (e.g.
macOS), can be configured differently in different settings paths, and
potentially can be changed at runtime (depending on usage).

Change-Id: I2217f13336ec816d28bd447ccd14a405bff2a3a7
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-29 13:39:16 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Marcus Tillmanns
c27c36a64b examples: Dont try to load pixmaps from URLs
Change-Id: Idd4e01509077c27d2bd1569566788710e99d9539
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-07-29 09:33:43 +00:00
hjk
a663473f8f QtSupport: Convert to Tr::tr
Change-Id: Id0f7a2e55f329fe37b9c23e890c314e145e36d79
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-07-25 12:00:34 +00:00
Alessandro Portale
f54097fefb QtSupport: Remove screenshot cropper
Reduce maintenance by removing a feature that broke in 7.0, caused
assertions. The absence of the cropper won't most likely be noticed,
because the examples thumbnail size was increased quite a bit in the
last Welcome Screen redesign.

Instead of cropping, we now always scale the thumbnail to
ListModel::defaultImageSize. As a benefit of this simplification, the
thumbnail is now also High-DPI enabled.

Fixes: QTCREATORBUG-27141
Change-Id: I57cafb000c3095dd387cd96814b6e946980b2aed
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-05-24 13:54:46 +00:00
Eike Ziller
fb1f19c7c1 Fix duplicate entries in examples dropdown
Both the "normal" Qt node adds an example set, and the Android/
Automotive node adds another one with the same paths, leading to e.g.
two items "Qt6 6.2.4" in the dropdown for the examples.

De-duplicate example sets with the same paths, which we already do if an
example set and a Qt version itself refer to the same path.

Fixes: QTCREATORBUG-27294
Change-Id: Ia469045b2f2812612fcd8328bdfd223479b8d449
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-04-20 08:24:15 +00:00
Eike Ziller
73a78a70da Examples: Make sure to select some example set if available
In the case of the bug report, there is no previously selected index,
and no valid Qt version, so setting the index to the highest Qt version
doesn't result in anything. Make sure to select something in the
dropdown, if we have any item there at all, even if our heuristics don't
come up with an optimal selection.

Fixes: QTCREATORBUG-26791
Change-Id: I2327594f0fd36e312aa71d1990e8ccab4a488367
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-04-06 06:28:58 +00:00
hjk
a48a96e05c QtSupport: Introduce a type alias for QList<BaseQtVersion *>
Change-Id: I96b0eccc04da2f4a1a4e5ea9bdceb91b3fa3d724
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-01-24 14:38:20 +00:00
hjk
25f5771aa4 Rename QtSupport::BaseQtVersion to QtVersion
... and the Utils::QtVersion enum to Utils::QtMajorVersion to avoid
conflicts.

Change-Id: Ib688c67388272b7204a91444155f60b8c18a56bd
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-01-24 12:13:19 +00:00
hjk
30f171a491 Utils: Rename FilePath::normalizePathName to normalizedPathName
Change-Id: Ib7bcc9968749649f762a396d3861f7b67711e926
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-26 07:03:13 +00:00
hjk
db014de91c Utils: Introduce FilePath::normalizePathName()
... as wrapper around FileUtils::normalizePathName, and use it
in some places.

Change-Id: I42792e1f175b8119c8db930eae80a9f822ac70fa
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-08-23 10:37:26 +00:00
Eike Ziller
c1f90aeca2 ICore: Change some path API to use FilePath
Change-Id: Id841d6177206a021c9e606ce560b47d1ae6e52b9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2021-04-26 08:03:47 +00:00
Alessandro Portale
b77318cb74 WelcomeScreen: Don't rely on image format auto-detection
The examples and marketplace pages show images that are decoded from
data buffers. This happened without specifying the encoding format,
which triggers image auto-detection.

The negligible overhead of the auto-detection is usually not a problem,
but the probing of image QImageIOHandlers that goes along with auto-
detection can emit warnings. A concrete example is a warning in the TGA
plugin which was added in Qt 5.15.1.

Task-number: QTCREATORBUG-24853
Change-Id: I596604bde7621acf92e825f45e0c23ac4e90b78d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-27 16:15:10 +00:00
hjk
43b658e9e7 Utils: Drop Utils::SkipEmptyParts again
We require Qt 5.14 nowadays.

Change-Id: Iff245257d3cb19207007c0445ee13814e66152dd
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-21 12:42:27 +00:00
hjk
430a33dcd9 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-07-06 06:07:13 +00:00
hjk
1c81a3b3e8 All: Use Utils::SkipEmptyParts
Task-number: QTCREATORBUG-24098
Change-Id: Iab45de9a9c17ddc39a0e343b1175d4f6cb94b098
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-17 05:55:25 +00:00
Eike Ziller
83ed1e3a7c Allow plugins to register additional example sets
Change-Id: Icfa2a8093a5cffd86dc029fd1b06117f599203ab
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-04-03 08:37:57 +00:00
Assam Boudjelthia
f9e7a0d44a QtSupport: Qt for iOS Examples lists only "ios" tagged examples
Based on change ff7047e.

Change-Id: I41f9961d78ccfc001bb5687f17574ef9d81ee2d4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-14 09:34:41 +00:00
Assam Boudjelthia
ff7047edb0 QtSupport: Qt for Android Examples lists only "android" tagged examples
In the welcome page Examples tab, Qt for Android kits shows all
available examples which might not be properly tested or intended for
Android. Thus, such a kit should only lists examples tagged for android.

Task-number: QTBUG-80716
Change-Id: I22dafb5d5829cb2f6b3c55ff6f2d251c0ee08557
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-13 10:38:48 +00:00
Christian Stenger
7a239ff62f ExamplesListModel: Fix leaks
Amends e96feed16f.

Change-Id: I9782fbc7f2ce0698efc0011e26653eb280ee23d4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-01-27 13:11:31 +00:00
Christian Kandeler
e96feed16f ExamplesListModel: Fix leak
Change-Id: I7243049cd9e9afa3b4790fda7967ce392c94527d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-01-23 08:54:06 +00:00
Christian Stenger
f2351b06e0 QtSupport: Extract welcome page list model handling
...and move it to Core.
Preparation for easier re-usage to avoid re-implementing
the same more often.

Change-Id: I4c902e74e63dd5416f2a52b4b08900e28e2a052a
Reviewed-by: hjk <hjk@qt.io>
2020-01-20 12:27:05 +00:00
Friedemann Kleint
499115fd94 QtSupport/Example list parser: Improve error message
Output line, column and message.

Change-Id: I1fa0b3da6b20b27ce3e2f66442751ab31e21904b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-01-14 10:01:53 +00:00
Eike Ziller
a3f5fa09f5 Show examples also of "invalid" Qt versions
As long as we are able to find examples or demos for them.
Android Qt versions can be "invalid" until the device settings are
fixed, but that doesn't prevent us from showing examples.

Task-number: QTCREATORBUG-23058
Change-Id: I8d3351a3f31727b062b37f5bd462709a9d6ef9dd
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-10-08 13:15:48 +00:00