Commit Graph

176 Commits

Author SHA1 Message Date
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
Christian Kandeler
72cb9e26a1 PathChooser: Move setTextKeepingActiveCursor() to FancyLineEdit
We want to re-use it elsewhere.

Change-Id: Iadb03e2e85bc25f9111a8817170b9ec1f2f0a7b1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-02-07 13:33:49 +00:00
Eike Ziller
f5647cc2c4 Allow non-host-platform libraries in Add Library wizard
Since much of the available UI and behavior depends on which platform's
library we start with, let the user choose a platform filter.
Default is the host OS.

Task-number: QTCREATORBUG-17995
Change-Id: Ic8bec7ac30eecf08c1684da4f2823a8add8f6d20
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2018-10-01 12:27:21 +00:00
Orgad Shaneh
d88a0d8e68 Utils: Modernize
range-based for, nullptr, member initializers, override.

Change-Id: I21ac5b23883c08dbd75819bb3298bc956cdb972c
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2018-09-21 05:37:39 +00:00
Alexis Jeandet
08508522fe Expand QTC variables from PathChooser
This would allow to use QTC variables in settings using this widget
such as Extra Debugging Helpers.

Change-Id: I8ac6de46f359f58a501f09774d992a19b48d7d5f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-09-11 10:00:58 +00:00
Eike Ziller
8e05783019 Merge remote-tracking branch 'origin/4.7'
Change-Id: I4332eba9f1f66fef185359c79c4d96420d8b78ca
2018-08-30 08:31:25 +02:00
Eike Ziller
93a6dd0c67 Fix editing of custom executable path
When editing the path for a custom executable run configuration, the
text cursor would jump to the end every time anything is typed. This
makes changing a part inside the text very cumbersome.

This happens because the executable aspect registers a "display filter"
that transforms the input to native separators.

Solve that issue generically for the path chooser by resetting its text
cursor position after the path has been set, if the input field has
focus.

Change-Id: Ic0a178e942da8df1e53b5d90c78a5bf1675865c2
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-08-28 08:12:12 +00:00
Alessandro Portale
e38410b76c Utils: Modernize
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default

Change-Id: I8d44d9405011a1878353baf9325f7af90b89db02
Reviewed-by: hjk <hjk@qt.io>
2018-07-20 13:36:22 +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
Alessandro Portale
3d3f14e3fe Prefer using 'override' instead of 'virtual'
warning: prefer using 'override' or (rarely) 'final' instead of
'virtual' [modernize-use-override]

Change-Id: I6dac7a62b627fa1353b4455e1af92f869c2571cc
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2018-07-11 16:31:35 +00:00
Alessandro Portale
caff9f9aac Use C++11’s override and remove virtual where applicable
Fixes warning: prefer using 'override' or (rarely) 'final' instead of
'virtual' [modernize-use-override]

Change-Id: I4b8b8ecce028dfd051fe14984b40115e92057a40
Reviewed-by: hjk <hjk@qt.io>
2018-06-27 07:13:21 +00:00
Christian Stenger
2653cb229c Utils: Fix manual usage of PathChooser
When manually typing inside a PathChooser that expects an
existing command it was no more possible to type a trailing
slash without tricking the PathChooser.

Change-Id: Ie30e7b0de030f4a3d64fce89ed799c03a594261d
Reviewed-by: hjk <hjk@qt.io>
2018-05-14 13:07:25 +00:00
Tobias Hunger
4146a98599 PathChooser: Remove wrong comments
Change-Id: I2cd240ff79747dc8e3bac164beb3353960d0dc1e
Reviewed-by: hjk <hjk@qt.io>
2018-04-25 14:19:49 +00:00
Tobias Hunger
3d8be750b9 Environment: Use Utils::FileName for path() and related methods
Update users accordingly.

Change-Id: I9432e82308e9d0630514c6c8632aeb6b6ee0cf90
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-27 07:37:26 +00:00
Andre Hartmann
63a75e3f4a PathChooser: Modernize
* Range-for
* Remove QLatin1{Char|String}
* Member-init

Change-Id: I8c928a21cd1187e83264c88e1c62d81d82ed088f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-08-22 12:37:13 +00:00
Orgad Shaneh
5368e29050 PathChooser: Avoid unneeded validation when base is unchanged
Change-Id: Ia4b00d673725ff3718dbc9703c933a44fe2314dc
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-05-19 06:55:53 +00:00
Orgad Shaneh
d4ac34449b PathChooser: Expand ~ to home directory
Change-Id: I4d767b6978f69c0e0a8dbfb3ccd6fc5b33fc3984
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-05-05 09:49:02 +00:00
Montel Laurent
5d27bc747b Use QFileInfo::exists(...) which is faster that QFileInfo(..).exists
Change-Id: I0d2e61d84c74e60ef4f54074a4ca00f2d0835562
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-04-14 13:18:28 +00:00
Tobias Hunger
e3b40fa687 PathChooser: Consistently put "" around file names
This makes it a bit simpler to spot leading and trailing whitespaces.
Maybe that could help with problems like QTCREATORBUG-16805, but even
if not it makes our strings more consistent.

Change-Id: I65c486721967d9d3e17020641a1144d593f9bde1
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-09 10:00:33 +00:00
Alessandro Portale
1acec7ceb4 Utils: Get default error color from Theme
The default Qt:red for the lineedit in  Utils::PathChooser is unreadable
in dark themes. This change ensures that the color comes from the
current theme.

Change-Id: I7b890bb18e4b996cf0a8f0ac3286da87dd33f5f2
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
2016-07-25 11:49:02 +00:00