Commit Graph

43 Commits

Author SHA1 Message Date
hjk
363849a372 CMakePM: Also show type of options in configuration tooltips
Change-Id: Ie6b6b270c83d7c5df117c16d637f362e8c01eaad
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-02-07 15:40:24 +00:00
Cristian Adam
924862093e CMakePM: Apply Kit CMake configuration to Initial Configuration
When the user changes or adds new CMake Kit parameters, the changes
are reflected in the Initial Configuration.

Change-Id: Icca1c76749c772e946ff250f94b7965cf7cf9ee8
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-02-04 19:37:20 +00:00
Cristian Adam
201f91b867 CMakePM: Mark as changed only the changed values in "Batch Edit..."
Previously all values coming from "Batch Edit..." would be considered
as user changed values and be displayed with bold font.

This means that if I had -DMY_VAR:BOOL=ON and do a Copy and paste
in "Batch Edit..." I would have it displayed as user changed and
it would be passed to CMake as changed value.

Also it should be possible to start with -DMY_VAR:BOOL=ON, click
the check box to make it OFF and then do a "Batch Edit..." with
-DMY_VAR:BOOL=ON to set the value back to original value.

Change-Id: I5f6cb915b32a3288c1339135dabfd182ca16feda
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-02-04 19:36:10 +00:00
Alessandro Portale
ccafc11fa6 Utils: Remove unused theme role TextColorHighlight
TextColorHighlight is a harsh "egineer red" #ff0000 in all themes except
one, where it is grey. Actually, TextColorHighlight was used in one
place, which now instead uses TextColorError.

Change-Id: Idcd61637edaa045fc718cf35a9d34ff1d5a64dad
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-02-02 21:19:03 +00:00
Cristian Adam
0020ef7e30 CMakePM: Settings list UI changes
The CMake parameters QTreeView has now:
- alternating row colors
- row selection

Both key and value get the same font and foreground stylings.
- bold when the key is new or the value has been changed by user
- italic when the key has been inherited from kit or initial config
- red when there are differences between the inherited value and
  the current value

Change-Id: If09bb2c3e25f59938c5f56e6dd0d6817dfe442cc
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-02-02 20:20:00 +00:00
Cristian Adam
9c8f46a173 CMakePM: Add "Appy Kit/Initial Configuration Value" context menu entry
Now the "Initial Configuration" and "Current Configuration" displays
in red the mismatches between kit / initial value and respectively
initial and current configuration values.

By having a "Apply Kit / Initial Configuration Value" context menu
entry the user can resolve the mismatches if needed.

Change-Id: I2e272821c3ba396cd8a6b7c81e1437cb3fd4bbad
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-02-01 20:27:41 +00:00
Cristian Adam
dc825e11bd CMakePM: Fix "Reset" on changed values in Settings
Previously the reset button would only work on new items being removed.
User changes on existing items would not be reverted.

Change-Id: I8d9bde058487c9568bfb802f131a29ec32fc1f8c
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-01 19:10:50 +00:00
Cristian Adam
a7d3f9fdba CMakePM: Display current value in CMake settings as tooltip
If you change the value of a CMake parameter in CMake settings the
new value was not displayed in the tooltip, the old value was.

Change-Id: Ie182ef42f8bf48651d170da8054d7f60f9080088
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-01-31 15:14:07 +00:00
Cristian Adam
ff66f501f2 CMakePM: Do not flush CMake parameters model on parsing complete
The flush there was as a "hack" for the case:

1. failed initial configuration (CMAKE_GENERATOR as Ninja2)
2. successful configuration

The current configuration would get current items with unexpanded
values e.g.: QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}

But flush also removed the expanded values of the selected
initial parameters from CMakeBuildSystem::updateInitialCMakeExpandableVars

This is useful when CMAKE_CXX_COMPILER changes or
CMAKE_PROJECT_INCLUDE_BEFORE gets a new path to the new Qt Creator.

Change-Id: I480ce141d043d8ba6001fa47a54b066762b6a128
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-01-28 13:54:28 +00:00
Cristian Adam
0923d8676e CMakePM: Display CMake kit mismatch values in Settings page
updateFromKit() is now called on parsingFinished and the configuration
values that differ from the ones in the Kit's CMake configuration
will be displayed in red.

The "Initial Configuration" page will display the mismatches between
kit's CMake configuration and initial parameters.

The "Current Configuration" page will display the mismatches between
the initial parameters and the current CMake parameters.

The Tooltip is displayed with a bit of more space between values
for more readability.

Change-Id: I6ebfa71951cf979ab08f097befed2d43b74e4d6e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-28 12:42:25 +00:00
Cristian Adam
a0836a29c7 CMakePM: Refactor "Initial Parameters" as a tab bar item
Now we have "Initial Configuration" and "Current Configuration"
as tab bar buttons.

This way the UI can be shared between the two configuration states.

Task-number: QTCREATORBUG-26869
Change-Id: I8206032a2a5ac076629865057816edb99706f2ff
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-17 15:23:19 +00:00
Cristian Adam
3c7d0c5c98 CMakePM: Remove grouping of cmake cache variables
Having groups made from the first underscore is not necessarily
helpful.

In some cases it creates empty groups, which can confuse users.

We have filter and search functionality in the list, which can
help with finding the right items.

Fixes: QTCREATORBUG-26218
Change-Id: I751a59b49184ea57f55d3832ef4edc8a3c33e0da
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-05 13:04:19 +00:00
Cristian Adam
e12d7e863c CMakePM: Allow "Force to ..." context menu entries also for keys
Previously the "Force to ..." context menu entries were enabled
only for the items on the second column (values).

There is no reason not to have the same behavior for the items
on the first column (keys).

This way the user doesn't have the impression that something is
wrong if they trigger the context menu on the key and not on
the value in the list.

Change-Id: I02fcaf25340f2dbcbb808be8f27047acaaee5471
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-05 13:03:45 +00:00
hjk
3aa324ef1f CMake: Make CMakeConfig a proper class
Looks a bit more "object oriented" in my book.

Change-Id: I6a3b1b4691ec1c7465f652608678e8f31e7e52a7
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-07-21 13:25:30 +00:00
hjk
2ff446bd25 CMake: Simplify CMakeConfigItem::toBool() use
Change-Id: I60120a152174b7c3751b99ac92d31bdb9c3ab1d9
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-07-21 06:25:17 +00:00
Cristian Adam
fe540e8828 CMakeProjectManager: Remove isCmakeChanged state
Since CMake's file-api cache is the only source of truth for
CMake configuration, there is no need to keep track of such
a state.

Qt Creator will issue -D<var>=<value> -U<var> command line
parameters for CMake, which will update the file api json files.

Change-Id: I08e7041a95422549502eb7961f96570225e942fa
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-03-02 09:54:27 +00:00
Cristian Adam
145be455ee CMakeProjectManager: Add Batch Edit support for CMake configuration
For the initial CMake parameters one can have an edit dialog. Now it's
possible to batch edit variables also after the project has been
configured.

Change-Id: I406b8e7db16147032a75c82fddf9b7acec85c4bf
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-02-24 15:33:25 +00:00
Alessandro Portale
72d91dc94a Use qAsConst with non-const Qt containers in range-loops
... in various places

Change-Id: Ic6c0c1b9437a1ed402105c7a14a1f5f9454a68d4
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-02-17 14:43:29 +00:00
Asit Dhal
faa707e932 CMakePlugin: Make cmake build settings widget multi selectable
Fixes: QTCREATORBUG-22659
Change-Id: I5c2b88a30f35baa3a3f2b33e2722c4523a8abe44
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2020-07-21 13:28:09 +00:00
Tobias Hunger
01b0d4f8f5 CMake: Remove magic configuration from CMake
Get rid of magic configuration handling in the CMakeProjectManager.

* Use CMakeCache.txt as the sole source of truth, do not keep
  a shadow copy of configuration in the .user file
* Have initial CMake arguments that are easy to edit in batch
  (Fixes: QTCREATORBUG-18179) used whenever no CMakeCache.txt
  file is in the build directory. These allow for any thing that
  can be passed to CMake on the command line.
  (Fixes: QTCREATORBUG-16296)
* Ask when changes to CMake configuration were not applied
  (Fixes: QTCREATORBUG-18504)
* Run cmake with arguments effecting its configuration only when
  the CMake settings are changed in the UI, run CMake without any
  special arguments in all other cases.
* Get rid of the confusing dialog used to keep settings in sync between
  what is in CMakeCache.txt and Creator (Fixes: QTCREATORBUG-23218)

Change-Id: I26d55be7df733f084f5691ecf7d7b4352f58b8e7
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-06-09 16:34:00 +00:00
Tobias Hunger
5350288e45 CMake: Fix includes all over the CMake plugin
Keep internals internal, remove some unnecessary includes, add
some that should have been there.

This reduces the number of files that get rebuild when working
on CMake internals from over 1000 to about 200.

This patch also moves some code around that ended up being
in the wrong file.

Change-Id: Icd7366ac760dc85031040720418fbb16336dce9b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-04-20 10:05:24 +00:00
Tobias Hunger
1f6c0f63a7 CMake: Implement cmake true/false semantics
Implement proper support for cmakes true/false value semantics.

Change-Id: I127f73f62d1b7b21b2fee032f40c9cc448b876b8
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-06-07 11:13:11 +00:00
Alessandro Portale
17f169c291 CMakeProjectManager: Modernize
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using

Change-Id: I6a272bc3b75835840b3d6cbe83be6f50f94bbedb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-11-25 07:50:15 +00:00
Orgad Shaneh
7d3a79c696 Utils: Purge asConst
Replace by qAsConst.

Change-Id: I3301366f73c066c86f08df7188d70dc3b613c55c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-04-09 09:04:00 +00:00
Tobias Hunger
3f73f3a4f4 CMake: Fix "CMake settings have changed on disk"
* Improve the UI by showing settings in CMake and the project
* Fix setting CMake configuration to project

Change-Id: I6e127344551fa00f3f7e6170465cb3dda2e4a634
Task-number: QTCREATORBUG-17555
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-24 11:10:30 +00:00
Leena Miettinen
f4cd9cdb6a CMake: Fix UI text
Change-Id: I3587084925089c7bb7ffb9cfb09f6b822b215cd8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-10-24 08:47:52 +00:00
Tobias Hunger
b1157e4e63 CMake: Allow to unset configuration values
Change-Id: I649323e3c2cc51ea69dd7e216f30eeb653f3873b
Reviewed-by: hjk <hjk@qt.io>
2017-10-17 08:21:07 +00:00
Tobias Hunger
02533e61cf CMake: Fix project parsing notification
This builds on top of 08677c0b01 and
fixes one more code path to go through a common entry/exit point.

Change-Id: I1d00fa9242f247028e5d3b0ef3b5fe1d3f4cb03d
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-06 09:53:40 +00:00
Tobias Hunger
be376ae706 CMake: Enable type forcing for CMake configuation values
Allow to force the type for CMake configuration values, now that
this type changes how you can edit the values.

Change-Id: Id89e0ec8547b778fc0aff9a2e00c0d7406cbcac1
Reviewed-by: hjk <hjk@qt.io>
2017-09-19 13:17:50 +00:00
Tobias Hunger
f4ff420036 CMake: Improve delegates for CMake configuration
Change-Id: Ib1d2bfca1b2faafd36c53f24c6649e73ee0af190
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-19 08:42:20 +00:00
Tobias Hunger
dfec256dff CMake: Allow CMake configuration to be forced to string type
This allows editing values with misidentified types in Project Mode.

Change-Id: Ic74da2ca71cc9046cbbeb1202075976c9edd28b7
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-18 11:36:51 +00:00
Tobias Hunger
df22d2c717 CMake: Do not lose value when renaming key in config model
Do not lose the value when the key gets changed in the CMake configuration
view in Project mode.

Task-number: QTCREATORBUG-17926
Change-Id: I7c55f815bc918da0267eed57385c2d641568dc8c
Reviewed-by: hjk <hjk@qt.io>
2017-09-15 12:10:29 +00:00
Tobias Hunger
63ce81db5e CMake: Sort Project CMake configuration via the Proxy model
Makes renaming items feel more natural as they do no longer stick to the
top (note that currently you can only rename newly added items!).

Change-Id: I89d0dc7cb73e08d8b60900a96ffd2ab1c2b490c2
Reviewed-by: hjk <hjk@qt.io>
2017-09-15 12:10:19 +00:00
Tobias Hunger
cacb6b17d0 CMake: Group entries in project configuration
Change-Id: I6aa797f5ff49a5cc33dfbdf0b25dcd78abbff66e
Reviewed-by: hjk <hjk@qt.io>
2017-09-12 12:55:51 +00:00
Tobias Hunger
7e81d330d9 CMake: Hide INTERNAL and STATIC configuration entries in Project UI
Task-number: QTCREATORBUG-18403
Change-Id: I6b69305ff0dc337da1d8b20e0321be5ce1b1f595
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-06-20 12:03:15 +00:00
Tobias Hunger
087d6d7472 CMake: Mark changes to CMake configuration that contradicts a kit
Mark changes in the project that override configuration settings from the kit.

Task-number: QTCREATORBUG-17244
Change-Id: I3452116ad5f4626ffcd85dfcc86715b6946d6572
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-20 12:48:22 +00:00
Tobias Hunger
df62701801 CMake: Mark configuration items that were taken from the CMakeCache.txt file
Change-Id: Id9e707d7b07d35ade44959955db61810e34f7b30
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-19 16:05:11 +00:00
Tobias Hunger
5a88e4c9ad CMake: Fix the config model merging data
Old user-settings used to get lost.

Change-Id: I5197c3b57b12d94e7464a86261a1364dd9aca266
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-02 12:00:03 +00:00
Tobias Hunger
aa118539a4 CMake: Fix warnings about cmake configuration model
The index was handled wrongly.

Change-Id: I8a98c7a16e32798a9b7662c6c5c1683d248580da
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-27 15:01:53 +00:00
Alexander Drozdov
76b76f2723 CMakeProjectManager: Support drop down selector for options
CMake provides "hack" for cmake-gui, that allows set options variants
and select then from drop down list. Allows Qt Creator re-use this
solution.

See:
- https://blog.kitware.com/constraining-values-with-comboboxes-in-cmake-cmake-gui/
- http://blog.bethcodes.com/cmake-tips-tricks-drop-down-list

Drop down values can be added to option via:
 SET_PROPERTY(CACHE OptionName PROPERTY STRINGS Option1 Option2 Option3)

This solution should not restrict to provide any other value, it
provides only suggestion for user to select one of prdefined values.

Change-Id: I8fc52155775f1e04979db8206bb42363df9359e8
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-10 15:07:30 +00:00
Stanislav Ionascu
c1d735503b CMake: make it possible to insert new vars in project settings
Task-number: QTCREATORBUG-16238
Change-Id: If98acc4f27cabbb606b2fc1017096da626ba1144
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-05-24 08:44:57 +00:00
Tobias Hunger
b910b36458 CMake: Also treat "yes" as true for boolean settings
Change-Id: I78426ec5b6b2cf0a1d4cca26202632b27e2036e9
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-05-20 11:55:19 +00:00
Tobias Hunger
28e4306865 CMake: Add UI to display and edit cmake configuration
Change-Id: I95944dcd58dc86023c2757068979f92b8989011b
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-02-15 11:57:11 +00:00