Commit Graph

218 Commits

Author SHA1 Message Date
hjk
39570fb675 Utils: Rename PathChooser::rawFilePath() to unxepandedFilePath()
That's what the implementation does, and judging from the using code
wasn't quite clear.

Change-Id: I4ca776ba4da83a36162adad2dd595eb39eb0f43d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2024-06-19 14:26:05 +00:00
Eike Ziller
5af531cd39 Utils: Fix build with MSVC with C++20
Rename process.h back to qtcprocess.h

MSVC's "threads" standard header includes <process.h>, and that ends up
including our process.h from Utils.

There already was a hacky workaround in place for a similar issue with
MINGW, but that doesn't work with MSVC because that doesn't have

Simply use a name that doesn't conflict.

Change-Id: I1159cd2096b4f2dbc4a1728d0131dd6edd30ebd3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2024-02-28 08:09:05 +00:00
hjk
fb2b861fb7 Utils: Replace explicit cleanPath call by FilePath::fromUserInput
Change-Id: I85199d1389864971f6e9fb6ca4290ad094b0a1c5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2024-02-21 07:46:59 +00:00
Christian Kandeler
4a722bfa9d Utils: Add async variant of DataFromProcess
... and make use of it in PathChooser.

Change-Id: I0e81afec2caf38f488a8ab98b55016535c187fc2
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-20 11:59:43 +00:00
Christian Kandeler
737bf48a0c Utils: Add convenience class for parsing and caching process output
... and base the existing uses of this pattern on it.

Change-Id: I0eaf7535b68ff8c3e8e1c923ce08e63896cc83f7
Reviewed-by: hjk <hjk@qt.io>
2024-02-19 13:26:08 +00:00
Jarek Kobus
10ff747a0f Use more std::chrono and std::chrono_literals namespaces
Change-Id: Ib8c83988d7afe35d81b87ff8c5c87eef2082f12d
Reviewed-by: hjk <hjk@qt.io>
2024-01-23 09:32:43 +00:00
Jarek Kobus
afc67468e6 Process: Get rid of setTimeoutS()
Add an extra arg to runBlocking() function instead.
Use std::chrono::seconds for timeout.

Change-Id: I7c3c21e8f26a2ccbed157d15083d6ef0b4cd2f7e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2024-01-22 20:27:51 +00:00
hjk
2bf886ed73 Utils: Use a bit more Key and Store
Also, separate the Key into a separate header to minimiz impact
on #include load.

Change-Id: I4f719cad4d23a71a9c228d0b7f5c2409fd6e24d5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-24 05:58:05 +00:00
Orgad Shaneh
ccfa32dda2 PathChooser: Remove unused lambda captures
Change-Id: I1f6763f20297e685c62c10195dfe74a5fddaf35a
Reviewed-by: hjk <hjk@qt.io>
2023-08-17 14:50:51 +00:00
hjk
f2aaf68b0c ProjectExplorer: Use FilePathAspect(s) in ExecutableAspect
In the read-only case, make it look like the previously used
StringAspect with LabelDisplay.

Change-Id: Ica76c1ba23bf9b3946c227e303cc1336f3f8d5b4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-07-04 05:23:24 +00:00
Marcus Tillmanns
83111bb3f6 Utils: Make validation async
Changes FancyLineEdit to accept two types of validation functions:

AsyncValidationFunction, which returns a QFuture and takes the new text,
or SynchronousValidationFunction.

Especially PathChooser is changed to use async validation function to
improve snappyness of settings pages that do heavy validation,
for instance the Debugger page.

Change-Id: I1677e7d8acc29e36c69a867850304b7913e6ae7e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2023-06-29 13:25:03 +00:00
Jarek Kobus
a0f6e8dc04 Utils: Rename qtcprocess.{cpp,h} -> process.{cpp,h}
Follows QtcProcess -> Process rename.

Change-Id: I97235a9a40cb7fd52944515b7ab878d96528f919
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-04 05:52:26 +00:00
Jarek Kobus
470c95c94b Utils: Rename QtcProcess -> Process
Task-number: QTCREATORBUG-29102
Change-Id: Ibc264f9db6a32206e4097766ee3f7d0b35225a5c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-05-04 05:52:16 +00:00
Marcus Tillmanns
a374dd8bfe Utils: Fix PathChooser validation
Change-Id: I5b0ad8a1011f51c5db732fe454c409812b406c17
Reviewed-by: hjk <hjk@qt.io>
2023-04-04 08:41:31 +00:00
hjk
2766b4004b Utils: Continue Environment/EnvironmentChange consolidation
Make Environment a stack of changes that gets "expanded" to
a full environment before things are actively accessed.

Later this expansion should be done lazily if possible.

Task-number: QTCREATORBUG-28357
Change-Id: If1c7bfdb9f58b81e71c51ed87ee75d6964a47019
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-03-24 07:45:35 +00:00
Jarek Kobus
33badfa660 PathChooser: Don't leak menu
Found by memory analyzer.

Amends b3f82887a3

Change-Id: I580ab0873f5c3556445a87d9fc2c806eeb48c57e
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-02-06 10:51:44 +00:00
Alessandro Portale
4d6827dde9 Utils: Tr::tr
Change-Id: Ic03e20993f05fb5b49a12c891d86afb2c8e18e08
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-02-01 13:48:22 +00:00
hjk
5f359a1dff Utils: Start Environment/EnvironmentChange consolidation
The plan is now to keep 'Environment' as the concept name, but
have what is currently 'EnvironmentChange' as implementation,
as keeping a full env vs env change(set) distiction gets messy.

First step is to cut the direct dependency of EnvironmentChange
from a (current) Environment that causes circularity when moving
the implementation.

Change-Id: Id8b512b311071611b750b27af59549ce7c2ce8e6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-27 11:24:36 +00:00
hjk
ea1d729669 Utils: Move PathChooser::expandedDirectory() to its only user
... and simplify its use given the always empty base dir there.

Change-Id: Ieeff7f31653db1512edc2cc448f80efc9bb7222e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-23 13:49:16 +00:00
Eike Ziller
2688a9629c Merge remote-tracking branch 'origin/9.0'
Conflicts:
	src/libs/utils/pathchooser.cpp
	src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp

Change-Id: I7ae3f91618c4a4ccb088679caea72b2a81590960
2023-01-13 09:16:25 +01:00
hjk
f561740a0b Utils: Guard against endless loop in PathChooser
Adding a slash to the text in the path chooser for a custom build
directory currently triggers an endless recursion.

This here does not fix the actual problem but at least prevents
the crash.

Task-number: QTCREATORBUG-28682
Change-Id: Ic7d70ccfaccc1fd9437ca41e8b40b027718af6cb
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-12 12:12:23 +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
hjk
bf060b426f RemoteLinux: Use remote path choosers for gdbserver and qml paths
Change-Id: Ibf65b08bc1cb9d92a6e7561bd1e97a3e13ea5a7d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-14 10:58:21 +00:00
Marcus Tillmanns
b3f82887a3 Utils: Change browse button to OptionPushButton
Allows the user to choose whether he wants to browse local files,
or remote files.

Change-Id: I0d262034a5c2df56bea2efca876c9019099e3da9
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-12-09 08:59:13 +00:00
Marcus Tillmanns
e83a6bacb6 Utils: Fix pathchooser for remote directories
PathChooserPrivate::expandedPath has a hack that interferes with remote
paths when they are already absolute. This patch short-circuits it to
keep absolute remote paths intact.

Change-Id: I6438842a693653404aa07160de9f68bdbf22519b
Reviewed-by: hjk <hjk@qt.io>
2022-10-18 07:07:05 +00:00
hjk
1e8089d5b7 Utils: Drop argument from PathChooser::rawFileChanged
Preparation for further consolidation.

Change-Id: Ia297d78763a24c168ae5fd13fbe30f6963f33fc7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-09-19 11:35:49 +00:00
hjk
1567d24980 Utils: Replace PathChooser::{fileP,p}athChanged signals
... by a new PathChooser::textChanged signal.

They were both emitted in reaction to the underlying line edit's
textChanged() signal.

Use 'textChanged()' as name to mimic/match the Qt side. This also
makes it more clear on the user code side, when this happens.

Some textChanged() consumers should probably use editingFinished()
instead, but that's left for later changes.

Change-Id: Ib07347f616cbf1c5d09bc2f8671ca860d185d1f9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-09-06 05:01:51 +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
3462bc67be filesystem: Add QFSEngine for filepaths
Change-Id: Ibd0c88c69863c0877138d8cc45541530c359bd9c
Reviewed-by: hjk <hjk@qt.io>
2022-07-21 13:14:01 +00:00
hjk
8295714ff6 Utils: Shuffle PathChooser expansion responsibility around
Change-Id: Iaee0c21e8e1c99cc034bee5b892587d3137b5508
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-17 10:19:59 +00:00
hjk
2837f4d777 ProjectExplorer: Pass macroexpander (again) to WorkingDirectoryAspect
Broke with 8dacb123e0.

Probably calls for a more centralized approach again. Later.

Change-Id: Ibf52487d68d7938d4b5dfb38f1f0a5b0e1a97bc3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-05-30 14:45:47 +00:00
Jarek Kobus
304ab10642 Utils: More forward declarations / drop unused headers [P-R]
Round 1 - focus on headers.
For classes with initial in range [P-R].
Try to keep the same separators between different kind of headers.

Change-Id: I01fb80b93164a7fe4c0bd2cd8f9e4f27523efefa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-25 07:18:44 +00:00
Jarek Kobus
0a8dbaf153 Utils lib: Remove unneeded includes from cpp files
It's a result of a team work consisting of yellow triangle and me.

Change-Id: I8b4812766da70e0785ae71bf0cb71357379e2514
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-05-19 12:37:20 +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
Alessandro Portale
fcf9537dc5 Various FilePath::fromString -> fromUserInput changes
Change-Id: Ic9c5e2f5c0375468651557f504b101572b72ac06
Reviewed-by: hjk <hjk@qt.io>
2021-09-23 16:28:54 +00:00
hjk
10807aed88 Utils: Introduce PathChoser::absoluteFilePath()
As we have a valid context to resolve relative files here
this is a good source for absolute files that don't depend
on QFilePath::absolute{File,}Path or similar.

Change-Id: Iaf592aa746023f80de517703e32e6b80a3d0fd7e
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
2021-09-13 10:10:15 +00:00
Alessandro Portale
2d994620d1 Utils: Fix setting the path via slotBrowse()
Amends: 0d7f357294

Change-Id: Iae5e13b5d4d869d7e727f614f540767fca32d770
Reviewed-by: hjk <hjk@qt.io>
2021-08-27 14:31:08 +00:00
hjk
57a90b019f Utils: Introduce a FilePath::searchInPath() convenience function
Diverts to searchInDirectory(). Use it in some places.

Change-Id: I9e5642f0ae0ed4dd9fb9f34bcaa11a25bd26c690
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-23 11:56:24 +00:00
hjk
0d7f357294 Utils: Use more FilePath in PathChooser
Change-Id: I0a59cb7b8c613a5533e02ad29088f58de02ff578
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-23 09:49:50 +00:00
hjk
0416e15612 Utils: Return FilePath from PathChooser::homePath()
Change-Id: Ib67435cb828e6bb55f76bfd6eb13165f46922c00
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-19 04:29:25 +00:00
hjk
632b725821 Git: Proliferate FilePath use in GerritModel a bit
Plus some code cosmetics.

Change-Id: Idc07e881c09cbc7347396ef1bb60cce00539250c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-08-17 07:52:42 +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
hjk
68313a1e27 Android: More FilePath use in CreateAndroidManifestWizard
Change-Id: I9e54d4534f4df99c972096e749c30f37e578158f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-16 06:25:56 +00:00
hjk
a78665ede7 Utils: Rename FilePath::searchOnDevice to searchInDirectories
Makes it a bit clearer that there's no magic path use or similar
beyond this point.

Change-Id: I86c06850d16bf777db05ad23b540d8096926c059
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-12 08:29:09 +00:00
hjk
6418eb2dda Utils: Use EnvironmentChange instead of Environment in several places
For path choosers this makes it easier to change the actual base retrospectively
based on the device for the file path entered by the user.

In other cases "end user code" only knows that something needs to
be added to PATH to get a proper environment. This here lets this
code to specify the change alone without bothering about the base
environment this might be applied to.

Change-Id: I726aaa2fd2feb0bee7158f601aac660b0ac6327b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-08-11 13:33:52 +00:00
Christian Stenger
400426ed9f Utils: Handle resolving paths and validation more appropriate
Manually editing the path inside a PathChooser will trigger some
validation and may end up in constructing some invalid paths
but still marking them as valid.
Beside this it will make the cursor jump to different locations
while typing which ends up in creating even more incorrect paths.
So, avoid creating invalid paths and mark the resulting path
as invalid if it is.

Change-Id: I27f55ae03745474fc6b91c44cdbc307c581fb2f8
Reviewed-by: hjk <hjk@qt.io>
2021-08-09 09:30:28 +00:00
hjk
8e41a401b0 Utils: Fix pathchooser auto-search-in-path for remote cases
Amends 11a40e02f2.

Environment::searchInPath only works for local setups, the
remote replacement is FilePath::searchOnDevice.

Change-Id: I8a2ba51903d3308ca9198fbf1154779c78e69e63
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-05 13:58:00 +00:00
hjk
11a40e02f2 Utils: More remote file use in PathChooser
Change-Id: I5db0e24d6cb3058c2b3c0d45b3eb362124cdd190
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-07-16 11:43:49 +00:00
hjk
3cdeb1a119 Utils: Fix FileChooser error marking for directories
Amends  b84c8cf892.

Change-Id: I108110cc682d331947c8eb47f62121ed02cd45f9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-14 13:28:31 +00:00
hjk
b84c8cf892 Utils: Allow remote paths in PathChooser
At least for the red marking of valid/invalid.

Change-Id: I91f856f93ba74f6b62a540322c2445691afbf170
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-07-14 10:06:03 +00:00