Commit Graph

3532 Commits

Author SHA1 Message Date
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
53050255de Utils: Rename FilePath::normalizePathName to normalizedPathName
Change-Id: Idf5faab1cf55d6f7cca493c8ad451825310f5d66
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-08-23 11:15:01 +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
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
67d2a4186b Utils: Remove some unused code from BuildableLibrary
Change-Id: I2d720faf57d644bd3b734383df5c4bdcaa7af961
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-23 07:20:25 +00:00
Jarek Kobus
7bc8672968 Assert that startLauncher() was called before starting any QtcProcess
Change-Id: Ieab97f7428c04ba90fc9a637ed8c29c8e97dec69
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-20 10:31:27 +00:00
Jarek Kobus
ef45478707 Assert that we are starting a valid process launcher executable
Change-Id: I48b18bd4ce821d59622de77c602677303c9d7625
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-20 10:17:23 +00:00
hjk
fd7fe32c09 Utils: Remove no longer used QtcProcess::start(QString, ...) overload
Change-Id: If74b1247c6c6afccfc04cff8915a9b759c8bfcaa
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-08-20 09:46:17 +00:00
Eike Ziller
b09b6bd747 Merge remote-tracking branch 'origin/5.0'
Change-Id: I370268624bd6e91e7b44fa236e913f5f55867e17
2021-08-20 09:50:30 +02:00
hjk
142a34464f Utils: Avoid adding duplicated slashs in FilePath::pathAppended
Change-Id: I791412906e94a967a61d9b3212b704936c447183
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-08-20 05:33:34 +00:00
Jarek Kobus
a09bedf1cb Conform to Creator's include style
Get rid of <QtModule/qclass.h> style and use <QClass> directly,
like in all other places in Creator. Remove some unneeded
declarations.

Change-Id: I1b5630850c570e5d86df01a341f7352bc1971e48
Reviewed-by: hjk <hjk@qt.io>
2021-08-19 15:59:03 +00:00
hjk
f8ff5d0652 Utils: Use FilePath::toString() for logging reasons
Change-Id: Id3a26327994e55a8d400739e9b7a6e7dcb9b99c5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-08-19 11:49:20 +00:00
hjk
9cc48d1106 Utils: FilePathify Archive::unarchive further
Change-Id: I22ddc35e5d94cd000f6a3ed09325223c49417335
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-19 11:32:44 +00:00
hjk
285ec1476e TextEditor: Modernize SnippetsCollection
More FilePath use, foreach, less .h exposure.

Change-Id: Ie24324b33333733736f0cd12c7637798fc88aa34
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-19 11:05:42 +00:00
hjk
026b4ddcda Utils: Introduce a QtcProcess::startDetached
A convenience wrapper around QProcess::startDetached().

Change-Id: If4228e8405ad4d5e172930593a6f670874211767
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-19 09:56:49 +00:00
hjk
21b1bfc73c ClangFormat: Spread FilePath
Change-Id: Iedddd78b183b2290f98411e7c70807c1828f1c25
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-08-19 08:41:52 +00:00
hjk
584217a52f Use more FileUtils based file dialogs
Change-Id: I1e7ec0493c26afe58e17afb8923a2b1023f6dcd4
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-19 08:33:22 +00:00
hjk
6e8c4aa835 Use new FilePath::setPermissions in a few cases
Change-Id: Ic7122c86c273a87134ea8cd1a00b1bbdf5035971
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-19 08:33:12 +00:00
Jarek Kobus
9966cc4bcc Start and stop the process launcher in tst_qtcprocess
Change-Id: Ib28450d10c699abe3964f8bef2ff24baae0074f7
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-19 07:44:48 +00:00
Christian Stenger
28d2674b54 Utils: Adjust FilePath::relativePath()
When using the same path for the anchor and the relative path
we end up in an empty path which is conceptually wrong.
Especially when passing such a result directly without further
checking may lead to bad issues.
Return a path containing just the '.' (dot) instead.

Change-Id: I86e1ab91e6610831fc05bd81776d278e9fe10105
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Jochen Becher <jochen_becher@gmx.de>
Reviewed-by: hjk <hjk@qt.io>
2021-08-19 04:39:05 +00:00
hjk
fd0f6fd5e6 Utils: FilePathify RemoveFileDialog
Change-Id: I3402fb7b44ec556d7de79d42b3ddcb606048780d
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-19 04:29:46 +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
The Qt Project
d8a61bcea4 Merge "Merge remote-tracking branch 'origin/5.0'" 2021-08-18 14:42:50 +00:00
Jarek Kobus
6d18df6207 Remove QTC_REL_TOOLS_PATH and use RELATIVE_LIBEXEC_PATH instead
Change-Id: If737d7050985f2ae03d543c63347ea465a65c648
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-08-18 14:30:02 +00:00
Jarek Kobus
bd5b6b60c9 Add asserts ensuring that methods are called from right threads
Change-Id: I4f6d8dc706f89c3fb043655d775d02f878c546d6
Reviewed-by: hjk <hjk@qt.io>
2021-08-18 14:14:47 +00:00
Eike Ziller
94d352ab28 Merge remote-tracking branch 'origin/5.0'
Conflicts:
	src/plugins/autotest/testresultdelegate.cpp

Change-Id: If172206f231fc2a9f4a672cd2e6eaeaea4988c96
2021-08-18 16:14:24 +02:00
hjk
27708158db Utils: Introduce FilePath::setPermission()
And implement it for the direct access docker case.

Change-Id: I5c91402630a5b010fdbcaab96c435f66a36f2e3e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-18 12:25:44 +00:00
Jarek Kobus
a7e8ddd725 Add some more comments
Add some developer comments explaining which method
is designed to be called from a certain thread.
Add also some comments about in which thread
certain QObjects live in.

Change-Id: I38b10216cc29f8a86fd784e588e913407f0fb776
Reviewed-by: hjk <hjk@qt.io>
2021-08-18 10:24:18 +00:00
Jarek Kobus
43de2deebc Wake up QtcProcess when error occurred
Pipe the error packet through the caller's handle and flush
it immediately if the caller was awaiting for any signal.
Stop awaiting for any signal when we have flushed error signal.
In this case return false from waitForSignal() method
in order to mimic the QProcess behavior.

Fixes: QTCREATORBUG-26136
Change-Id: Ie80b4a63bd19a6309d4791ad39a698bd91bb8967
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-08-18 10:19:28 +00:00
Christian Stenger
bfee48ab0b TextEditor: Limit size of tool tips
Otherwise we may end up in crashes deep inside Qt code on Windows.

Fixes: QTCREATORBUG-26112
Change-Id: Iabdd544271a99b680adad3abb84341db2bf2c1f3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-18 08:34:45 +00:00
Eike Ziller
6d44c28f0a Merge remote-tracking branch 'origin/5.0'
Conflicts:
	src/libs/utils/qtcprocess.cpp

Change-Id: I1f7419d927e8534dfdcd10db998f97a6efd4d3e4
2021-08-18 09:48:39 +02:00
hjk
8885ef7e5a Utils: Pass dialog parent to Utils::* file dialog
Amends 3edc5673b5.

Turns out quite a few potential uses have other parents than
ICore::dialogParent().

Use a nullptr parent to mean ICore::dialogParent() to keep the
caller side simple.

Change-Id: Icfe1daafd710ae273d286679e0c8e2a3a27da552
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-17 12:54:08 +00:00
Jarek Kobus
7726267d07 Fix a deadlock when doStart() is called from launcher's thread
In case when QtcProcess::start() is being called very early,
just after the launcher socket was started but not ready yet,
a start is being delayed. In this case doStart() isn't
called directly from the caller's thread, but it will be
invoked later from the launcher's thread, when the socket is ready.
In this case we may have a deadlock, since calling
doStart(), sendPacket(), sendData() and finally handleRequests()
results in a synchonous chain of calls in launcher's thread,
so the mutex locked in sendData() will block synchronous call to
handleRequests(). In order to fix it we unlock the mutex
in sendData() before calling handleRequests().

Change-Id: I6c13994d0b05b624567c75ffbd2ac7cc0d77df61
Reviewed-by: hjk <hjk@qt.io>
2021-08-17 12:23:39 +00:00
hjk
2663af4c74 Utils: FilePathify Archive
Change-Id: Ia6b972b50f8b1cc7c5829ac863a5881849ea7678
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-17 11:43:15 +00:00
Jarek Kobus
9a73d394c3 Compile fix
Amends 837a707ec7

Change-Id: Icf1fa0a2536a57c8182bf7a3e651f9f2ab420516
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-17 08:56:29 +00:00
Jarek Kobus
837a707ec7 Fix a crazy case when waitingForFinished should process ReadyRead
Fix "runBlockingStdOut" autotest for tst_qtcprocess.
This crazy case relies on the fact that a blocking
call to waitForFinished() lets ReadyRead signals to
be processed in meantime and the handler for ReadyRead
may terminate the process. However, when no handler
for ReadyRead canceled the process, the blocking call to
waitForFinished() should return to the awaiting state
for the remaining time. From the caller's side everything
happens during a blocking invocation of waitForFinished().

So, in order to behave like this we implement waitForSignal()
in a loop. After we have flushed all the pending signals
we check if we have flushed the signal we were awaiting for.
If so, we break the loop, otherwise we continue. In order
to detect the case when the cancel was called during flushing
we set the m_awaitingShouldContinue flag before flushing.
The cancel() method clears this flag. Then after flushing
we check if the flag was cleared - in this case we don't
continue awaiting.

We reset the m_waitingFor state always after wait condition
finishes awaiting. Before, we didn't reset it when the
wait condition timed out.

Change-Id: I210f446659cabfd89bdfdd1fc8e8396d9470effc
Reviewed-by: hjk <hjk@qt.io>
2021-08-17 08:15:06 +00:00
Orgad Shaneh
a6917a5484 QtcProcess: Do not discard stdout and stderr buffers when callback is set
All the uses of setStd{Out,Err}Callback in the codebase call proc.stdOut/
stdErr after the execution.

This triggered a soft assertion that was apparently not noticed so far.

It broke for example prompt for conflict resolution on Git pull/rebase.

Change-Id: Ib4b8301f1f50b2b66f02fc4dc6c14d93f895ea33
Reviewed-by: hjk <hjk@qt.io>
2021-08-17 07:58:48 +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
bbde6ac9bf VCS: Use more FilePath in ShellCommand and surroundings
Change-Id: Ie8c5fac09b45a54bcbe9a876044b653e7fccede5
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-08-17 07:16:04 +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
Jarek Kobus
80d8bca395 Remove repeated line
Change-Id: I9973be042d06ffc0c2d47c617d34d873434117f3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-16 08:20:35 +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
52e5023bcc ProjectExplorer: Use Utils::CommandLine in ProjectExplorer::Runnable
Change-Id: Id965f1f9047dcbc3ea5c9ddaa550d12668cf8ae6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-13 15:04:30 +00:00
Jarek Kobus
3143ba79e3 Use process launcher implementation for all QtC code base
Use QTC_USE_QPROCESS env var to switch back to the original
implementation based on direct use of QProcess. By default
a new implementation employing process launcher will be used.

Change-Id: I75c3efb579e26de377fc785404f1e2a08367d994
Reviewed-by: hjk <hjk@qt.io>
2021-08-12 13:04:12 +00:00
Eike Ziller
ba5f2e27f0 Merge remote-tracking branch 'origin/5.0'
Change-Id: I86049934ae744e22e4a728ab79c0cf6880ff3c7d
2021-08-12 11:05:11 +02: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
Jarek Kobus
be6299a50a Fix compiler warning about suggested parentheses
Change-Id: Ibe7e32676bcae43ee270273c7a79ab959172d5b0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2021-08-12 04:22:29 +00:00
hjk
4000819262 Utils: Weaken QTC_CHECK in QtcProcess::stdErr()
The previous tighter check is actually good theoretically, but currently
ShellCommand::runFullySynchronous triggers it and disentangling there
is not trivial. So weaken it a bit for now to not annoy users.

Change-Id: Ifc6b5713b398db0af0f604834c37ff361c2a1ed3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-08-11 15:08:13 +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
hjk
6405f9c436 Utils: User FilePath in ProjectIntroPage
... and fix some fallout.

Change-Id: I8f4ae8304e29614417f7d6b664e165f618b57f71
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-11 11:49:16 +00:00