Commit Graph

219 Commits

Author SHA1 Message Date
Alessandro Portale
ad1ae7bd48 ExtensionSystem: Tr::tr
Change-Id: I93266b536d441634ce5f8017c4b77b6d4ffe5b89
Reviewed-by: hjk <hjk@qt.io>
2023-01-24 10:24:39 +00:00
Kai Köhne
4e9c1d126c Replace GPL-3.0 with GPL-3.0-only
GPL-3.0 is deprecated by SPDX.

Change done by

 find . -type f -exec perl -pi -e 's/LicenseRef-Qt-Commercial OR GPL-3.0(?!-)/LicenseRef-Qt-Commercial OR GPL-3.0-only/g' {} \;

Change-Id: If316a498e3f27d2030b86d4e7743b3237ce09939
Reviewed-by: Lucie Gerard <lucie.gerard@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-10 08:05:04 +00:00
Jarek Kobus
36ffacabe7 ExtensionSystem: Fix some clazy warnings
Fix use multi-arg.
Add a context object to lambda connections.

Change-Id: I02711c9ecc55188fb174895f7df59f25effd0834
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-12-07 09:28:32 +00:00
Jarek Kobus
f5f3bbcc59 Use more Utils::isMainThread()
Change-Id: Ia3c6f6dca53c5d7487b0813de16f06c52af47aa5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-10-11 07:34:12 +00:00
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +00:00
Eike Ziller
04e50438eb Utils: Remove Utils::optional
Since we are now requiring macOS 10.14 we can remove our local
implementation of optional and use std::optional for macOS too.

Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2022-09-01 06:58:04 +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
Jarek Kobus
1fade11be2 PluginManager: Avoid using sender()
Change-Id: I30df454a9bab9896ec39a03d7d261fc47fbd7b7e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-20 10:29:37 +00:00
Eike Ziller
5dcfe401a3 ExtensionSystem: Add support for static plugins
Loads all plugins that are known via Q_IMPORT_PLUGIN()

Change-Id: I3c1fe223ce6e4dcdb7729f5ab3e782e78bca5afc
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-05-02 08:48:57 +00:00
Eike Ziller
f613df1075 ExtensionSystem: Clarify text in "Problematic Plugin" dialog
If Qt Creator crashed at startup, we show a dialog pointing fingers to a
plugin, the next time Qt Creator is started.

Make clearer that the problem was the _last_ time Qt Creator was
started, not during the current startup.

Make clearer that the "following plugins are disabled too" refers to the
case when the user decides to temporarily disable the plugin.

Change-Id: Ie6cfed2e445b9e5c1598783474ce8a169d82bc3a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2022-03-28 10:13:11 +00:00
Jarek Kobus
8e0ae8ba96 QtcProcess: Limit the inclusion of qtcprocess.h
Move the rest of QtcProcess enums to processenums.h.
Move ExitCodeInterpreter into processenums.h.
Remove superfluous Utils:: prefix.

Change-Id: Iaa596f353d33d6930085a621b114cc15a35caa80
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-02 13:30:39 +00:00
Eike Ziller
f562ebf239 Mimetypes: Make implementation switchable between new and old
- configure with QTC_USE_NEW_MIMEDATABASE to switch to the new one in
  utils/mimetypes2/
- added utils/mimeutils.h header for the Qt Creator specific static
  wrappers, that also includes the "public" headers for MimeType et al
  from the new or old implementation, depending on configuration
- change all utils/mimetypes/ includes to utils/mimeutils.h
- move the implementation for the wrappers to
  utils/mimetypes(2)/mimeutils.cpp
- also move the MimeDatabase declaration in the "old" implementation
  back to utils/mimetypes/mimedatabase.h

Change-Id: Ie8de229c035d6cd9a5e4739dc0fa78d9c17228e3
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-25 07:19:58 +00:00
hjk
bd4a501f15 Replace some uses of HostOsInfo::withExecutableSuffix with FilePath
Change-Id: Id72e9fd04dd4995ff2775ee919f747018cbcc339
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-17 11:48:48 +00:00
hjk
7c28c4f744 Utils: Introduce a FilePath constructor from char arrays
Similar to QT_RESTRICTED_CAST_FROM_ASCII to avoid the need for
decorations in user code.

At the same time, drop some convenience constructors and functions
in CommandLine and Icon essentially serving the same purpose.

Change-Id: Ida4e5ac19c2da0a4298a97b2a8e1511d56bbb79d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-17 05:34:10 +00:00
Christian Stenger
a5aef91411 ExtensionSystem: Add settingspath to system information
This information is re-used inside the System Information dialog.

Change-Id: I71d2b9a1574ea1cd3f68349d974555ec5625f185
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-08-10 06:12:48 +00:00
hjk
430e81facd All: Replace most SynchronousProcess by QtcProcess
Change-Id: I0bf22fef2cd4a7297ef5a1e9aa9c3e2b9348ba42
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-23 07:55:31 +00:00
Jarek Kobus
5b0889777a Add a test for a crash in ModelManagerInterface
Task-number: QTCREATORBUG-25350
Change-Id: I4ea31e7936cc77dcd8f3fc494b5ecbd83858a766
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-22 12:42:53 +00:00
Jarek Kobus
422409bf26 Add TestStringTable test
The TestStringTable tests the fix provided for a crash in StringTable
on shutdown.

Amends: f4ab1279fd

Task-number: QTCREATORBUG-25417
Change-Id: I5a4a7e4a20e1b9611682a976d38dee17d4603c5c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2021-06-07 12:16:27 +00:00
hjk
0ba4338467 Utils: Rename QtcProcess::Result::Finished to FinishedWithSuccess
To make clear that this is not just any finish.

Also change FinishedError to FinishedWithError, to create
symmetry.

Also adapt enum member description to reality.

Change-Id: I13e05391eb86fdb24e2ae660f14dfddb282e1104
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-06-02 14:16:36 +00:00
Jarek Kobus
0f535703aa Implement scenario player
A scenario player may be used for testing Creator crashes which
can't be easily tested with "-test <plugin>" option. Some crashes
are triggered when Creator unloaded plugins and left the
main function. This may happen due to some other threads may
still be running. This scenario can't be tested using plugin tests,
since when the test finishes, Creator still has its plugins loaded.
Also it's not possible to quit Creator from inside the plugin
test, as if we do it, we couldn't report the test result.

The follow up patches will introduce the first test scenario
and provide automatic test for testing against regression
in StringTable.

The scenario player may be potentially used for other purposes,
including automatic presentation of features (yeah!). However,
most probably the API should be further developed for other purposed.
This is just a starting idea.

Change-Id: I0f5c3c028f35a5cdf9130c2cf315dd4b68e81126
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-06-02 11:59:33 +00:00
hjk
90ad902486 Utils: Remove CommandLine argument from QtcProcess::run{,Blocking}
Makes run() more similar to what start() looks like.

Also add some asserts to make sure run() and related functions are
only called on SyncronousProcesses, as these are currently the only
ones where this works.

Change-Id: Idee6076c3f40a484db5c17f5bb348698cc83d220
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-19 13:01:51 +00:00
hjk
55f768e1b0 Utils: Make process results accessible through QtcProcess object
The result is fully stored in the object anyway. Using the extra
SynchronousProcessResponse structure only causes copies of
the data and complicates access on the user side in
a lot of cases.

The result bits are now also accessible individually.

There's obvious room for follow-up changes on the topic, e.g.
ShellCommand::runCommand's parameter list could shrink to
just a SynchronousProcess parameter.

Change-Id: I45aa7eb23832340be06905929280c012e1217263
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-05-14 13:19:01 +00:00
hjk
c23cdd9262 Utils: Merge {synchronous,qtc}process.{h,cpp} file pairs
Mechanical to prepare merging the actual classes.
Adapting #includes.

Change-Id: I77a2c28129287778bc870c30cb890cd26bc2e62b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-10 09:47:51 +00:00
Eike Ziller
720dbf557f PluginManager: Remove plugin crash check at shutdown
The check was mostly introduced for the case where Qt Creator crashes at
startup. For example if the user enabled or installed a plugin that
makes Qt Creator crash at startup, they get the chance to temporarily
disable that plugin because otherwise they cannot even access the plugin
dialog.

For shutdown that makes less sense, and is irritating for development.

Change-Id: I7267d74f4bb2d302c946a7488cc645ca4c7f864b
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-02 07:46:16 +00:00
Eike Ziller
2e261fbf60 PluginManager: Use new settings API
Avoid writing defaults to the settings.

Task-number: QTCREATORBUG-24430
Change-Id: I029224cfc69bd6de0f7e20b93e06c5fd58050d3d
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-12-23 11:05:58 +00:00
Eike Ziller
41b73594ad Add API for saving settings with default value
We should never actually write default values into the settings, because

- if the default value changes in a later Qt Creator version, the new
  default should automatically take effect if the user didn't change the
  value
- it senselessly grows the settings file

Add a QtcSettings class that extends QSettings by a
"setValueWithDefault" method, which does not write default values to the
settings, and actually removes the settingskey if the user switches back
to the default.

Use it at the places where we already do this manually.

Task-number: QTCREATORBUG-24762
Change-Id: Ia76414cb21e8521f3aeed1e37b43ae4fb3393ea3
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-12-04 08:25:17 +00:00
Alessandro Portale
81f3452e1c Aggregation/Utils/ExtensionSystem: Make member functions const/static
readability-make-member-function-const finds lots of member functions
that could be made const. This change just picks getter functions that
really should be const.

readability-convert-member-functions-to-static finds non-static member
functions which do not access this. This change turns most of them
into static ones, but leaves some non static to keep the class API
consistent.

readability-static-accessed-through-instance fixes the places where
the originally non-static, now static functions were called through
instance.

Change-Id: I8cf16c01f7988a7c9d073b5f8ede6a9706b94fb0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-11-27 09:16:08 +00:00
Eike Ziller
bd6161e2b2 ExtensionSystem: Add option to skip startup crash check
It can lead to problems, especially in automated environments, so
provide an option to skip it.

Task-number: QTCREATORBUG-24294
Change-Id: Ided0d12a87dc60fcaee6ad7e2747982cb0806a8f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-08-14 07:45:43 +00:00
Eike Ziller
d67ab36c6f Plugin install: Check if archive contains a usable plugin
Checks if there is a library file which is a Qt Creator plugin
that is compatible with the version of Qt Creator that is running.

Change-Id: Ic5284e3803c45b8e2ef0d30afccb1680fabf43f3
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-07-02 06:59:47 +00:00
hjk
8efe0df9dc ExtensionSystem: Port PluginManager to QRegularExpression
Task-number: QTCREATORBUG-24098
Change-Id: Idd52e7fe37c8ea8937af7123755b324dd326bb16
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-16 08:28:26 +00:00
Eike Ziller
f1fddfd408 Fix "Header" documentation in ExtensionSystem and Aggregation
Change-Id: Ia6c05bdc1fe810c6afcc337320ed0512fff098c0
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2020-06-15 08:25:03 +00:00
Eike Ziller
6f1ad0b0cb Fix extensionsystem API documentation for new qdoc
Change-Id: I2303e46a3e5840a3c23c84a9126237eeb2eb21d9
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2020-02-20 12:01:54 +00:00
hjk
89e2327f23 ExtensionSystem: Replace a deprecated endl
Change-Id: Ib6b297b0176518d3bc2db1e45476cc9e8c00b2e0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-19 08:34:31 +00:00
hjk
d3d294cd81 ExtensionSystem: Some modernization
Mostly 'foreach'.

Change-Id: I5390d03bb5cc37c3674b61cea6f5d22bae554ed2
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-14 09:50:07 +00:00
Eike Ziller
eadfe1a421 Merge remote-tracking branch 'origin/4.11'
Change-Id: Iaa3142a7109bc23c2e6ff96d061a58a9c0e31a54
2020-02-07 16:20:03 +01:00
Leena Miettinen
62a2b1718d Doc: Fix QDoc warnings in ExtensionSystem class docs
Task-number: QTCREATORBUG-23544
Change-Id: I6500fefdaa919f807fa4bf4372426b19a6e57aa2
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-07 15:12:41 +00:00
Orgad Shaneh
0737291d54 Merge remote-tracking branch 'origin/4.11'
Change-Id: I65ce6aa917219a8f8b91b48c7077f8097248375c
2020-02-06 12:50:22 +02:00
Leena Miettinen
055bfb9339 Doc: Fix PluginManager docs
- Mark internal functions \internal.
- Remove docs for signals that QDoc seems to consider internal.
- Remove obsolete information.
- Edit for language and style.

Task-number: QTCREATORBUG-23544
Change-Id: I8c7b48e6c338acd3d529b81203b4beb64ab4fe24
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-06 09:23:22 +00:00
Eike Ziller
c9a4176b2f Plugin manager: Robustify writing/reading of lock-file
On some platforms the settings path might not exist at the time that we
want to write the lock file, so make sure the directory is created.

Amends 392b063fe8

Change-Id: Ic72ee59120cd1bb9ec3175d5032c94a936530300
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-01-21 13:16:39 +00:00
Eike Ziller
392b063fe8 Guard against crashing plugins
If a plugin crashes, ask the user if that plugin should be disabled.
For this track which plugin currently is changing its state. Remove that
information if the state change was successful.
At startup check if there is a plugin for which we wrote, but not
removed that information.

This is especially interesting if the user installed 3rdparty plugins.

Change-Id: I5729aa5c786b653d5bd53304f4fbeaca35ec9e71
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-01-20 10:39:28 +00:00
Eike Ziller
be19b00289 Provide "Restart Now" functionality
And use it for the plugin dialog and when changing the UI language.

Change-Id: Ic767837d2526409f7ec46d7e4612a1499f19459e
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-01-07 12:46:59 +00:00
hjk
e3b1106afa Compile fix with recent Qt dev
The reasoning in 1b4766e26c did not take into account that the scope
of QT_NO_JAVA_STYLE_ITERATORS may change over time, as done with
f70905448f6 in Qt base.

Change-Id: Ib1966ff26c4d36d5f62e149d6b45baa4aecf825d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-29 08:54:18 +00:00
Christian Kandeler
928550ed79 PluginManager: Provide helpful output if unit tests cannot be run
We can show the errors directly, rather than asking the user to re-run
Creator with different arguments.

Change-Id: If8196ba3a496406f5539a91e678d26a9a4801b85
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-26 10:14:11 +00:00
Eike Ziller
8e376ab340 Merge remote-tracking branch 'origin/4.10'
Conflicts:
	src/plugins/baremetal/iarewtoolchain.cpp

Change-Id: I483e81d7e920e724fb7cde84a8f6fa9bce4cd518
2019-07-25 09:38:09 +02:00
hjk
8b72e92167 Utils: Add CommandLine convenience constructors
... taking a QString for the executable.

This weakens the very explicit QString -> FileName conversion via the
named constructors for the special case of constructing a CommandLine.

I think that's worthwhile here, as it reduces the noise on the caller
site under circumstance where the nature of the thing is obvious.

Change-Id: I27b4a73639728893d053b2e7ba65cb745f0ffe83
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-23 15:51:45 +00:00
hjk
eb67ab31e7 ExtensionSystem: Remove one deprecated use of QTime
Change-Id: I6bb4657127fdc1d79631059d26a1e35672af87e4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-23 09:04:39 +00:00
hjk
ca4ba34229 Use Utils::FilePath in SynchronousProcess
Adapt callers and surrounding code.

Change-Id: Ie6c1883a44169cf9d790d06b660f46d24dc24c89
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-06-11 08:11:07 +00:00
Eike Ziller
e0b0a08e50 ExtensionSystem: Move away from QList
Qt 6 API will move away from it.
Use QVector for API and some std container for internal things.

Change-Id: Iff14d48a47d5ac52ade875d9c8c84ad8a4f577d8
Reviewed-by: hjk <hjk@qt.io>
2019-05-27 14:21:00 +00:00
Orgad Shaneh
bdc2b4b59f Remove hard-coded disabling of debug logs
Instead, set the default level of all logs to QtWarningMsg.

The call to setFilterRules overrides the user preferences in qtlogging.ini.

Change-Id: Id5f6cd550d14ff7f45ae04c5d3110e0bafb0f072
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-10-13 16:36:58 +00:00
Eike Ziller
e2e9707510 Fix plugin loading profiling report
We print a report both before and after a plugin's initialization method
is called, but only the time spent till after the method call should be
counted.
This makes a different for the delayedInitialize cycle: Before
delayedInitialize is called of a plugin, there can be a delay after the
previous one. But this delay should not be counted as part of the
initialization time of the plugin.

Change-Id: I4e5fb53cd83cb36a45a599cfc3f1f8539f6327f9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-10-01 08:13:57 +00:00