Commit Graph

202 Commits

Author SHA1 Message Date
hjk
0a37ff4149 Utils: Move some more FilePath-only functions to FilePathAspect
Change-Id: Id814e69339d510e88efbf95108c7573bcc53a87b
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-07-21 12:34:35 +00:00
hjk
ce998a1661 Utils: Move pathChooser accessor from String to FilePathAspect
Change-Id: Ida3cf1ea8249461bd48327b0c77de1e66a2541e6
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-07-21 08:52:48 +00:00
hjk
6847c7c5ae Utils: Consolidate some duplicated code in aspect implementations
Change-Id: Iad6b81d13705ce6ad752f2855fb47ea038ffe581
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-07-21 07:42:12 +00:00
hjk
7cc6078756 Utils: Let aspect transition functions indicate there was a change
Helps to make it easier to reason about the necessity of emitting
*changed signals.

Change-Id: Ieab29b25f5cc2799e193417b9cab02c99501c60a
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-07-20 13:52:24 +00:00
hjk
635e8c1614 Utils: Introduce a FilePathAspect::expandedValue()
Currently and long-term synonym for operator(), to be used in
cases where (*this)() or such looks ugly.

Change-Id: I3f70ecd3298a1df394a0e3cc593917b4c7d36d82
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-07-20 10:39:43 +00:00
Jarek Kobus
6cc471f38d Utils: Replace QVector with QList
Make usages of QList consistent. In some cases the
declaration contained QVector arg, while the definition
had QList arg.

Remove some unneeded includes of QList.

Change-Id: I7c15b39f261cefdeec6aaaf506ff4cc981432855
Reviewed-by: hjk <hjk@qt.io>
2023-07-20 09:57:07 +00:00
hjk
2a31f17354 Utils: Use handleGuiChanged more consistently in aspect implementations
Change-Id: I53eb3416b27dca45bd30860f1fb0ec674c98240e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-07-19 05:16:32 +00:00
Christian Stenger
9338f7a4d7 Utils: Fix visibility handling for aspects
Otherwise we may fail to hide widgets of aspects that are explicitly
set invisible while construction.

Change-Id: I2679c8fa22e79e4eb32ca5ae4266010d8cf9387d
Reviewed-by: hjk <hjk@qt.io>
2023-07-18 11:45:43 +00:00
Eike Ziller
d127336753 Fix that aspects read&wrote install settings
Do not give them the QSettings object that has SystemScope.
Also rename the "globalSettings" term to "installSettings" locally and
in PluginManager, and the one for aspects to just "setSettings" (like
e.g. for TerminalCommand).

Change-Id: Iad051f6e507373042014db73b83d0b16944b7374
Reviewed-by: hjk <hjk@qt.io>
2023-07-18 07:59:26 +00:00
hjk
4ab1d75ee6 Utils: Introduce a staging area for gui values
Accessing gui elements is very aspect-specific, whereas the
rules when and how values are synchronized are rather general.

Splitting the two concepts and having a permanent 'buffer' area
that is synchronized with the gui elements if and only if they
have been created helps to keep the boilerplate needed per-aspect
at a minimum.

This value could also serve as "model" in case we wanted to allow
multiple "views" in different places of the gui onto that aspect.

Change-Id: I34832512b99c53cb0e4df437ee9b4c5d17a2ad8f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-07-18 06:53:28 +00:00
Eike Ziller
835201060d Merge remote-tracking branch 'origin/11.0'
Change-Id: I2e0e8dd5f9b42533c665255f8539e837938846de
2023-07-13 08:28:42 +02:00
Cristian Adam
ba755e50a3 Utils: Fix inverted logic for checkableDecider (continued)
Amends 6b6b1198dd

The commit above made sure that the display of the dialog was in sync
with the checkbox in the settings dialog.

Now also the "Do not show again" checkbox in the messagebox will be
reflected in the settings dialog.

Change-Id: Ieb186b134adac09c9846a64144056b3b89d297d8
Reviewed-by: hjk <hjk@qt.io>
2023-07-12 13:12:40 +00:00
hjk
e1ca7cf53f Utils: Let registered aspects know about their containers
Will help to set up macroexpanders with less boiler plate.

Change-Id: I521af3dc9d49524cf855e82eecc0132d1bcc40db
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-07-11 09:37:17 +00:00
hjk
96506f1f6a Utils: Further split StringAspect and FilePathAspect
... by introducing "proper" FilePathAspect::value() (and therefore
hiding the inherited StringAspect::value(() and a temporary stringValue()
for the transition period for the remaining users of the QString value.

Change-Id: I40cf4238a09a9009cda0decba1acac82bd730233
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-07-11 06:30:11 +00:00
hjk
ebda2068dd Revert "Utils: Move a few FilePath-only functions from String to FilePathAspect"
This reverts commit e8617dc0c0.

Downstream AppManager still uses a combined String/FilePath aspect
version.

Change-Id: I9de08785120622d76daaa7c4be20fb5abb933095
Reviewed-by: hjk <hjk@qt.io>
2023-07-10 16:17:14 +00:00
hjk
e8617dc0c0 Utils: Move a few FilePath-only functions from String to FilePathAspect
Change-Id: I682e158186a1ea7e374c9f0480e292018af07200
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-07-10 12:39:38 +00:00
hjk
04162ba291 Utils: Move some FilePath specific functions
... from StringAspect to FilePathAspect.

Task-number: QTCREATORBUG-29167
Change-Id: I6fc3bc22f905825443ebc31ebe44e7c27fdbcb56
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-07-07 09:59:01 +00:00
hjk
91513a53dd Utils: Make aspect settings access implicit
Generally, aspects should use fromMap/toMap, but some older pages
use {from,to}Settings with always the same ICore::settings().

To make that less intrusive on the user code side, make that globally
implicit.

Task-number: QTCREATORBUG-29167
Change-Id: I29a8e23a31eb8061bb143e93931a07c6741eb7f9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-07-07 09:02:29 +00:00
David Schulz
09c3413cf3 Utils: emit validChanged for the delayed valid check
of FancyLineEdit and PathChooser

Change-Id: I9719d32928d8166dfae7844af4eefc94ca143eb1
Reviewed-by: hjk <hjk@qt.io>
2023-07-06 13:00:36 +00:00
hjk
8e257dca2c Utils: Replace StringAspect::setFilePath()
... by FilePathAspect::setValue().

Closer to the intented uniform API.

Task-number: QTCREATORBUG-29167
Change-Id: Ife26046eaeef2e49108e42a31a2d32e453883e3c
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-07-04 11:41:31 +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
Eike Ziller
26e96bfad8 Merge remote-tracking branch 'origin/11.0'
Conflicts:
	src/plugins/debugger/debuggeritemmanager.cpp

Change-Id: I9d99d13feff9315f52eacbd84857c63cb69bf804
2023-07-03 10:24:09 +02:00
hjk
64c8c37bd4 Aspect: Fix recent regression in signal emission
Amends 379e7f906

Change-Id: Ia1599613e3c2575c7406cf49f3dd9487c9a1284a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-07-03 05:42:21 +00:00
hjk
98bba063b6 Utils: Use FilePathAspect::setDefaultValue
... instead of StringAspect::setDefaultFilePath.

Closer to the intended uniform access.

Task-number: QTCREATORBUG-29167
Change-Id: I87df385ef98873a0955010149a9a9b09a5f29daf
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-06-30 09:34:26 +00:00
hjk
72f269bf6a Utils: Add FilePathAspect::setValue
Phasing out StringPathAspect::setFilePath

Change-Id: If74d6b521ce6d558da83ab526057b32e8c37c243
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-06-30 09:20:09 +00:00
Cristian Adam
6b6b1198dd Utils: Fix inverted logic for checkableDecider
`BoolAspect::checkableDecider` was used only in CMakeProjectManager for
askBeforePresetsReload and askBeforeReConfigureInitialParams.

Now the checkbox with "Ask before presets reload" would also match with
the display of the message box.

Change-Id: I45fc7a977dbeb13df051375bd3dac36e7be7bdc4
Reviewed-by: hjk <hjk@qt.io>
2023-06-29 14:59:07 +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
hjk
379e7f906e Utils: Rework aspect implementation
This avoids some repetition and could be a step towards
having type storage in (or rather accessible from) the base,
so we can have aspects for more complex data (treemodels...)
that are not easily converted to QVariant.

Change-Id: I9797b3d5646195705212db1830d2b415291ac651
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-06-29 11:25:44 +00:00
hjk
091b853068 Utils/Core: Make an aspect container layoutable
Most aspect containers end in a widget at some time. Let them declare
how.

The optionspages don't need a layouter anymore when using their
settings' one. There was only one case where there was none, fix
that one (perforce).

Change-Id: Ibd39bcd4af98c3eae1daafa59f6c1d6e7a571989
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-06-22 15:22:01 +00:00
hjk
6b5276220e Utils: Move bool aspect to second column in forms by default
Also let the user opt out if necessary.

Change-Id: Ia7483a3b3de1ce0c119e00594b722e38fa2d0bb2
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-06-22 07:53:58 +00:00
hjk
f19481e6c7 Utils: Make FancyLineEdit placeholder validation optional
Validation makes only sense if the placeholder is similar to
the actual contents, like a file path, not for explanatory text.

Amends 3dcdbe9.

Change-Id: I81ff7a3cf72f28c0fe49824b574b0997ada2d09b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-06-12 13:17:17 +00:00
hjk
35c60cd7b4 Incredibuild: Auto-register aspects in build steps
Change-Id: Ic36ac230c92df4b18649aa19a57f7a424a593db3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-06-09 10:15:30 +00:00
hjk
49e17591ea ProjectExplorer: Use aspects as direct members in MakeStep
Less indirection.

Change-Id: Ie0086f7f2365512694fb3de77d3efc838e6e95ed
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-06-07 14:17:40 +00:00
hjk
f5d02f4bcb Utils: Fix compilation with recent Qt dev
After an update of Qt dev the following code in Creator fails to compile with

/data/dev/creator-out/src/libs/utils/aspects.cpp: In member function ‘void Utils::IntegersAspect::setValue(const QList<int>&)
/data/dev/creator-out/src/libs/utils/aspects.cpp:2323:35: error: no matching function for call to ‘transform(const QList<int>&, <unresolved overloaded function type>)’
 2323 |     BaseAspect::setValue(transform(value, &QVariant::fromValue<int>));

Work around by using a lambda.

Change-Id: Id5a844e7e5fe1846c4904dbad21472743439c4da
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-06 07:45:48 +00:00
hjk
5bacd9328e Utils: Add a overload taking a AspecContainer for TextDisplay
Change-Id: If6cc933e852b80c4ec6abcc2477db8852392ca69
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
2023-06-02 11:58:54 +00:00
hjk
64c48af15b ProjectManager: Auto-register build settings aspects
Add the necessary contructor to TriStateAspect, too.

Change-Id: Ieb0f19cdf95f7492380d7c4e5663f455e4da3452
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-06-01 11:36:43 +00:00
hjk
9375979698 Utils: Make PathChooser remote support configurable in aspects
... and switch is _on_ by default.

Change-Id: I82e66da477dae1ee955b81babc6230b67e530d45
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2023-06-01 08:31:46 +00:00
Leena Miettinen
08b5f64c1a Doc: Mark destructors as \internal instead of \reimp in Aspects docs
Document BoolAspect::value().

Change-Id: Ia7f359e9302d371e3ea79fc3fce04e3c3c9a22a0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-05-26 13:58:10 +00:00
hjk
320064f431 Utils: Allow more finegrained subaspect ownership in AspectContainer
Currently this luckily conincides with the register/addAspect schism
but that's not necessarily true in the future.

Change-Id: I05a59d74182dbdf81193ebd790d6f9bab2d30439
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-05-25 11:41:50 +00:00
hjk
75710fa369 Utils: Remove LabelPlacement::AtCheckBoxWithoutDummyLabel
This is identical in remaining functionality to AtCheckBox after
the recent layout builder changes (or rather, can be adjusted on
the layouting side by having appropriate empty cells)

Task-number: QTCREATORBUG-29167
Change-Id: Ic357de6fb756acb5926afe1fd361ee4b18b17afd
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-05-24 09:53:05 +00:00
hjk
0234ab6896 Utils: More aspects with new scheme
Task-number: QTCREATORBUG-29167
Change-Id: I76977d4d740556d28423ce9f632ee47e81822ee6
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-05-24 09:49:56 +00:00
hjk
962d9d55d0 Utils: Also allow FilePathAspects to auto-register
Task-number: QTCREATORBUG-29167
Change-Id: Iba301764072cc1ca3d3a335a8106ab121733b387
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-05-23 14:55:36 +00:00
Leena Miettinen
a0f64b133d Doc: Fix qdoc warnings in aspects docs
Add \a commands and mark things \internal if qdoc cannot find them.

Change-Id: If7a9303e5053af4eb58a08caafd53ffa6ee604b5
Reviewed-by: hjk <hjk@qt.io>
2023-05-23 12:51:01 +00:00
Leena Miettinen
e45609194d Doc: Remove period from the end of \sa
The HTML generator adds it automatically and qdoc warns about it.

Change-Id: I3917d7d23b16446e28ce7bfeb8f9195f21efd7fc
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-05-23 09:31:53 +00:00
Eike Ziller
3dc5bbfa1f Merge remote-tracking branch 'origin/11.0'
Change-Id: Ic7bd1fb91f46c5f8fef47b2c442382186aeb7ad3
2023-05-23 10:17:31 +02:00
hjk
a4c962aa33 Utils: Introduce aspect ctors referring to an "wrapping" AspectContainer
This removes the need to manual 'registerAspect' calls in most cases.

Whether the containers owns the registered aspects or just references
them is still determined by AspectContainer::setOwnsSubAspects()

Change-Id: Iadd17c919287f625bf5eb4964de4149d4da5a0f9
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-05-23 06:08:35 +00:00
Leena Miettinen
8c288bf05f Doc: Add "\inmodule QtCreator" to \class and \namespace docs
To get rid of QDoc warnings.

Change-Id: Idd39b7ae4327798c376f424c94d6617bcaee2258
Reviewed-by: hjk <hjk@qt.io>
2023-05-22 12:48:35 +00:00
Christian Stenger
c5818cfe6d Utils: Fix pathchooser handling for aspects
..especially when entering a path manually. Fixes some
soft asserts regarding the call guard and re-allows to
type a backslash directly to separate path from sub-path
instead of using wild workarounds like adding a dummy
character and adding the backslash before this.

Change-Id: I8cc8aaccf414d0fd9acc03d7c69e10ddd88dbfd9
Reviewed-by: hjk <hjk@qt.io>
2023-05-22 11:18:31 +00:00
hjk
d0881f5542 Utils: Remove a unused aspect ctor parameters
Change-Id: I6e3c6ce7b04a7817f35da10f1975ae2fec62b9e4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-05-22 07:16:23 +00:00
hjk
d740a355bb Utils: Rework CheckableMessageBox
Remove function overloads, thes are hard to read, to use and to extend.
I'd even argue this should be a plain default ctor and a few setters +
exec(), pretty much like Process::start() nowadays.

Move "decider" magic into a structure that can be filled ad-hoc outside
checkablemessagebox.cpp paving the ground for:

...removing  aspect dependency from CheckableMessageBox, Instead, add a
convenience function to BoolAspect.  Arguably, the latter is not needed
and could be done on the user side.

Use pointers instead of mutable references for in-out parameter.
Makes the "specialness" visible on the user side.

Pass ICore::settings() centrally as done elsewhere to reduce line noise
on the user side.

Change-Id: Ibb366353d1ea35401723fd05ce05672617a0a8fd
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-05-22 06:40:13 +00:00