Commit Graph

39 Commits

Author SHA1 Message Date
Jarek Kobus
a67aee30a6 Utils: More forward declarations / drop unused headers [S]
Round 1 - focus on headers.
For classes with initial in range [S].
Try to keep the same separators between different kind of headers.

SmallString[xxx] classes skipped for now.

Change-Id: Ie5c8edcb028e33eb8f9619e646afc462b91dca73
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-05-25 07:19:00 +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
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
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
Eike Ziller
a3391e7b33 Improve safety of VcsCommand
Amends 6e85ff9f4b

Using "invokeMethod(m_outputWindow, ..." has the disadvantage that it
crashes if m_outputWindow was deleted. This is nicely handled when
connecting to signals, so switch back to signals.

Change-Id: I6a681ac48a86536fa8e69e42d3c61ffa9d30c3d5
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-06-08 06:37:04 +00:00
Jarek Kobus
6e85ff9f4b Get rid of OutputProxy in ShellCommand
Before we have used the OutputProxyFactory, which
was called in the non-gui thread. The factory, when run,
created the connection between the thread and outside
world (e.g. VersionControl output window). Instead of
setting the factory we provide a set of virtual functions
called directly from non-gui threads. We also provide overrides
for them in VcsCommand class. Their implementation
safely redirects the calls directly to the VcsOutputWindow
through the QMetaObject::invokeMethod() with auto connection
as a default.

Task-number: QTCREATORBUG-25744
Change-Id: I09f2da278003b71095e953a51499a5513cb8f03f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-07 10:44:31 +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
73c0175f4b Vcs: Simplify VcsCommand::runCommand interface
The timeout and exit code interpreter properties are already
accessible via the SynchronousProcess parameter.

Change-Id: I1ba9c768a781009df65b5070a1d017c41d7e2663
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-05-17 09:10:49 +00:00
hjk
286efd58e8 Utils: Simplify internal ShellCommand::run* function interface
No need to pass some QtcProcess properties in parallel with a
QtcProcess object.

Change-Id: I0c04e5d7db5fd27d8855e661547ec45f417f0fd5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-05-14 15:09:05 +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
0c8d8c6b2a Utils: Don't expose Utils::defaultExitCodeInterpreter
Instead, make its behavior implicit if none is given.

Change-Id: I3c1a054751a0afe22d0f40a2fed6dd00b5aef205
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-11 13:15:25 +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
hjk
c262f40b67 Utils: Re-do Replace SynchronousCommand::flags by a named bool
The potential extensibility was never used, and a similar use case
in QtcProcess (setLowPriority()) used a named setter.

Change-Id: I87d84ea2206995d5069265f8df78f40cf2ba8a36
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-05-07 14:09:56 +00:00
hjk
635993fbdc Revert "Utils: Replace SynchronousCommand::flags by a named bool"
This reverts commit c617632e4d9291f1b50ec0c7e1a914a6a689284e.

To early, dependencies missing.

Change-Id: I91433aebbaf2c04cbb212585deb3cde5f3208974
Reviewed-by: hjk <hjk@qt.io>
2021-05-07 08:35:58 +00:00
hjk
9a7a0098a3 Utils: Replace SynchronousCommand::flags by a named bool
The potential extensibility was never used, and a similar use case
in QtcProcess (setLowPriority()) used a named setter.

Change-Id: I77d84ea2206995d5069265f8df78f40cf2ba8a36
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-05-07 08:24:18 +00:00
hjk
793d673f39 Vcs/Utils: Use Utils::Environment for ShellCommand
Change-Id: Ica289ab2f83d52270923c4ff4983860cfbe0b494
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-05 12:21:29 +00:00
Eike Ziller
4dc9d92b1e Remove unneeded QStringList forward declarations
Fixes build issue with Qt6, for which QStringList is now a
QList<QString>.

Task-number: QTCREATORBUG-24098
Change-Id: I0c81aa5bae413b836dbedea0bb6117b46f6f24c2
Reviewed-by: hjk <hjk@qt.io>
2020-09-29 08:58:12 +00:00
hjk
00b692e67e Utils: Use CommandLine in ShellCommand
... and adapt users.

Change-Id: I218523ffe34720d5fe199aa0ca6892a8dc2985fc
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-06-11 11:01:16 +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
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
Orgad Shaneh
2f41f35952 Git: Make commit a bit less synchronous
If gc.auto is configured, commit can trigger garbage collection, which
takes time. Avoid completely blocking the UI on this case, and at least
show the output of the commit command.

Change-Id: Id301c878c26599bbc363928a6770c04369a62f2f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-11-14 13:37:49 +00:00
Orgad Shaneh
594ee54e42 Utils: Add namespace qualification to signals arguments
Fixes the following warning, and connections to these signals:

 QObject::connect: Cannot queue arguments of type 'FileName'

This amends commit 7cee991c70.

Change-Id: I95e81fd9c328759daec29bf35c4b953983387d30
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-07-26 09:35:42 +00:00
Alessandro Portale
f6943a712a Utils: Modernize further
Many issues, mostly in headers, were not addressed in
e38410b76c

modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default

Change-Id: I320a51726db881e582b898948d53735ebb06887a
Reviewed-by: hjk <hjk@qt.io>
2018-07-24 12:21:42 +00:00
Orgad Shaneh
7cee991c70 Utils: Remove superfluous qualifications
Change-Id: I36e17dac0cff87f82f0ddaf97bc613389110f218
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-07-19 08:21:29 +00:00
Orgad Shaneh
b82ffb917b VcsCommand: Block auto reload while a command is running
Git rebase is executed in the background, and it can change a file multiple
times in a short period. If we reparse a file while this happens on
Windows, Git fails to replace it, the rebase action fails and the
repository becomes unstable (remains with a modified file).

See discussion at https://github.com/git-for-windows/git/pull/1666

Task-number: QTCREATORBUG-15449
Change-Id: Iba40a770a1df2dfff0dd1c874c491dfbe1cceb58
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-06-27 09:43:47 +00:00
Eike Ziller
c4b5048836 ShellCommand: Show some progress information without progress parser
Show magically timed progress when running a shell command without a
progress parser. The assumption is that the timeout is much larger than
the expected runtime, but still an indicator for how long it might take.
Progress manager does its magic on top of that.

This is e.g. used for the update info plugin, for which checking for
updates might take quite some while.

Change-Id: Ib3d3d37b86fac17816fe592e39e26a3d484bba26
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-07 11:24:33 +00:00
Tobias Hunger
ad2b968e4c ShellCommand: Fix crash with OutputProxy use
Pass a shared pointer into runSynchronous and runFullySynchronous.
That way the proxy will stay around for as long as needed.

Task-number: QTCREATORBUG-16612
Change-Id: Ic529440c81d85149abd67e5eeb564cc5f12181ab
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-18 12:06:12 +00:00
Tobias Hunger
b851b57ea3 Utils::ShellCommand: Force fully synchronous execution from UI thread
Force runCommand when run from the UI thread to do fully synchronous
operations. This prevents two event loops in one thread with (sometimes)
interesting side effects.

This also stops signals from being sent while the process is running,
but the remaining users seem to be able to handle that.

Change-Id: Id5eb9868b660419987730c60e3fbfb4cbced1218
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-07-15 14:49:02 +00:00
Tobias Hunger
d1be129abe Utils::ShellCommand: Add runSynchronous method
Add runSynchronous method and move code from runCommand there.

Change-Id: Ic7c452d583fd88468fc6466a683159ecd8328b48
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-07-15 14:22:39 +00:00
Tobias Hunger
c2075f6a73 ShellCommand: Pass OutputProxy to runFullySynchronous
No need to create a fresh one.

Change-Id: I3c7b92319ab43030620428987dfa254be7ac03a7
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-07-15 14:22:02 +00:00
Tobias Hunger
53c602633c Utils::ShellCommand: Rename runSynchronous to runFullySynchronous
This name just got free, so use it for the method that actually is
called if the process runs with the FullySynchronously flag set.

Change-Id: Ic86bb291d578ad06b74db1ab89a22b1b8cb4f4bb
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-07-15 14:21:40 +00:00
Tobias Hunger
cc27125092 Utils::Shellcommand: Remove runFullySynchronous
Nobody uses that anymore.

Change-Id: I24935ac8d25eb639eb253250749750993c740516
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-07-15 14:21:21 +00:00
Eike Ziller
967177d3d8 SynchronousProcess: Change exit code interpreter to function object
Change-Id: Ic48d4f5810f171c070f0980581fb6e45f6fe6b4a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-04-27 08:48:32 +00:00
hjk
39a38d5679 Wholesale conversion to #pragma once
Kudos to cgmb and https://github.com/cgmb/guardonce

Change-Id: Ifa8970734b8d43fd08c9260c645bdb0228633791
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-03-30 15:20:19 +00:00
Tobias Hunger
f72370f20a Update License according to agreement with Free Qt Foundation
* Update remaining files in src

Change-Id: I1896f17fcf34f71c3310c87899fb5171b8e4afb1
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:59:41 +00:00
Tobias Hunger
f2be797696 ShellCommand: Allow setting working directory per job
Change-Id: I6d541f87b76bdc7f1503f202792079f833e8932c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-06-10 13:04:42 +00:00
Tobias Hunger
ea476ffc39 ShellCommand: Store workingdirectory in the jobs
Not all jobs of one command can run in the same directory, so
prepare for having individual working directories per job.

Change-Id: Ice43361fe54f2b7153ccd38435f6108d83570082
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-06-10 12:05:31 +00:00
Tobias Hunger
a44c403b5f ShellCommand: Rename some signals
Rename the signals used to report stdout/stderr to make it clearer
what they actually do. Remove some unimplemented private member
functions while at it.

Change-Id: I7e856f906ccb45964f3b1b64336d4d8ebca7b9ee
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-05-07 13:07:14 +00:00
Tobias Hunger
eec0a03212 Vcs: Split up VcsCommand
Move the biggest chunk into Utils::ShellCommand, add some Qt Creator
specific magic in Core::ShellCommand and leave the rest in
VcsBase::VcsCommand.

Change-Id: I5fe6f7076e96023ad2164bcfaacfb3b65a7ff8a8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-05-04 15:27:25 +00:00