Commit Graph

195 Commits

Author SHA1 Message Date
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
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
David Schulz
0e6a4e757c Utils: filepathify pathchooser
Change-Id: Ib8e8493a5f7883bead353f015ef476ba0bfc3e0e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-14 07:59:38 +00:00
Cristian Adam
26e856254c CMakePM: Allow copy / editing of build directory
This reverts 69b0a2cafc

The build directory is preset and by having the ability to edit, you can
easily do a new build by appending a number.

When you have a new build directory a dialog will warn you that you'll
start from scratch. This is enough of a hinderniss to the user to start
typing and get lots of build directories. No need to have it read only.

Fixes: QTCREATORBUG-24451
Change-Id: Id1bc77d0fbcb071608f5ac83ddd6b8af943fdac5
Reviewed-by: hjk <hjk@qt.io>
2021-06-10 13:42:29 +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
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
Christian Kandeler
ad48f2639c ProjectExplorer: Consider build environment
... in "Open Terminal Here" action in the build configuration.

Change-Id: I0b1b15d4f1097cf48eb5a977f2ca5951b2f78377
Reviewed-by: hjk <hjk@qt.io>
2020-11-10 09:01:48 +00:00
Christian Stenger
d6ce25903d Utils: Validate pathchooser on setting default value
When changing the default value we may also change the current
state of validity, so trigger a validation immediately.
Amends b938764820.

Change-Id: I99bce422d3a0aa2b6418495b4a2c69255df06674
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-08-28 09:01:52 +00:00
Christian Stenger
b938764820 Utils: Simplify pathchooser validation
Allow to set a default value for the PathChooser which will
be used on the one hand as placeHolderText and on the other
hand for the default validation if the underlying line edit
has no text set.

Change-Id: I49d2f773cf3933cb30b54ee6de82290b480e743d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-08-27 04:29:47 +00:00
hjk
de58fc104a Utils: Document PathChooser::Kind
Change-Id: I0d984c9cae98b59abfb62a3fd6932d63783e9015
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-05-27 07:50:26 +00:00
hjk
82be99a53e Utils: Rename FilePath::rawFileName to rawFilePath
Change-Id: Idf8cad2b18087f511aa1efe54adbb5a427660016
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-05-22 07:24:51 +00:00
Tobias Hunger
69b0a2cafc PathChooser: Allow for chooser-only selection of files/directories
Makes the line edit disabled and read-only in that case.
We also need to change the custom context menu from the line edit to the
path chooser itself, because disabled widgets do not show a context
menu, but we still want to see the select & copy, and the special
items for opening explorer or terminal.

Task-number: QTCREATORBUG-23798
Change-Id: Ib653b4eaaedfbe54c614377795ddc52d21ac12c0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2020-04-21 13:18:43 +00:00
hjk
68c539bb9d Utils: Replace FileChooser::path() by filePath().toString()
Keep the old method for now to ease downstream porting.

The change is kept mechanical, there's a lot of cleanup possible now
on the user code side.

Change-Id: I936baedd45b7ba057f1c789a1bec896886f48eff
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-04-09 17:45:06 +00:00
hjk
79b680e7f0 Utils: Rename PathChooser::{f,setF}ileName() to {f,setF}ilePath()
It's returning a FilePath, so it's a better fit.

Keep the old versions as inline function now to ease downstream migration.

Change-Id: I535887928018f42b92895c8b0c82527f0d55e5ca
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-04-09 17:30:23 +00:00
Alessandro Portale
1519dbf0c7 Utils: Remove "ok" and "error" colors accessors for FancyLineEdit
Change-Id: I4e6706f284182226da8c9815394f36e9764feab2
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-12-19 12:15:41 +00:00
hjk
84d0e3dda8 Utils: Use FilePath for PathChooser::m_baseDirectory
... and collapse the two accessor versions to one.

Change-Id: I282753a0092601cff073684053ff914016452645
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-12-19 07:59:13 +00:00
Alessandro Portale
3dc511f1d1 Utils: Use Theme default "ok" and "error" colors for FancyLineEdit
...and remove the redundant setter calls elsewhere.

Change-Id: Iec71fe1bff7f8c9dd72bf3c3e643a4ed01e4dc80
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-12-18 15:27:07 +00:00
Eike Ziller
8df0653bf8 Merge remote-tracking branch 'origin/4.10'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/projectexplorer/gcctoolchain.cpp
	src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp

Change-Id: Iffdf48e782a734107ea170ebb3812e997cea0e7b
2019-09-12 09:08:04 +02:00
Eike Ziller
6476c62065 macOS: Work around window stacking order issue after closing dialog
Fixes: QTCREATORBUG-22906
Change-Id: Id3c9f5e87ac83686b34c7f6d2e445312fc401ba6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-09 13:44:29 +00: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
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