Commit Graph

12 Commits

Author SHA1 Message Date
Marco Bubke
5dbaf387ba Utils: Move C++ language details from ProjectExplorer to Utils
We want to use them in the backend processes too so it's nice to share them
in Utils. A concrete size was added too because they should be serialized.

Change-Id: Id5eb8f46643d5159f034fc9559f68a08d7e5847a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-15 10:37:03 +00:00
Nikolai Kosjar
6aa11eb75e CppTools/ProjectExplorer: Remove enum duplication
... between CppTools::ProjectPart and ProjectExplorer::ToolChain.

Change-Id: I8b448747e454adbed77547460383b8515462cc81
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-08 12:34:57 +00:00
Nikolai Kosjar
38ba61ec4f CppEditor: Rework showing/switching parse configurations
* Move the combox box for switching the parse configurations out of the
  "Additional Preprocessor Directives" dialog ('#'-button) to make it
  better visible/accessible. Also, decouple the extra preprocessor
  directives from the concrete parse context since this is not anymore
  in same dialog.
* The combo box appears only if multiple parse configurations are
  available for a file.
* The first time multiple parse configurations are detected, an info bar
  is shown that points the user to the combox box. A "Do Not Show Again"
  button is provided.
* Upon selecting an entry, the preferred parse configuration is saved as
  part of the session. The setting can be cleared with the context menu
  entry on the combo box.

Follow-up changes need to ensure that the display name and/or tooltip is
unambiguous, e.g. for qbs and cmake projects.

Change-Id: I9e9773704187291524ad7b605bfdddd83ef5b19d
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-02-03 11:58:27 +00:00
Nikolai Kosjar
7415964819 CppTools: Fix choosing project part after project open
As long as there are project parts for a source file, always determine
the best project part, instead of trying to stick to the previous one.
This ensures the best project part at all times and simplifies the code.

Change-Id: I25ea3eb43a5a3e6d93688d4b8965f596dc9ae22b
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-01-26 07:52:54 +00:00
Nikolai Kosjar
bddfe21961 CppTools: Fix using updated project part
1. Open a project consisting of two subprojects referencing the same
   source file.
2. Open the source file.
3. Click '#' in the editor toolbar and select the second project (part).
4. Update the project file, e.g. add a define
   ==> Editor does not reflect the added define

This is due to comparing project part pointers. Fix by using the project
part id that remains stable across project manager updates.

Change-Id: Ifd1a113e55ebe2ecf036cd7caafdbfd6e4cdf415
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-01-26 07:50:11 +00:00
Nikolai Kosjar
07f32ef57a CppTools: Use fallback project part if project is closed
...instead of sticking to the old one.

If a project is closed, the editor should reflect that. It also simplifies the code.

Change-Id: I9b8a94513d3b06a238cfc4ee60c11c0d0da3d93f
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-01-26 07:50:05 +00:00
Nikolai Kosjar
0b8df41387 CppTools: Provide hints about chosen project part for editor document
Parse issues can have multiple reasons (invalid kit, not a project file,
actual parse issue) and we should be able to tell them apart. With this
change, we can distinguish between the fallback project part and a
ambiguous project part.

Follow up changes will use this to display more accurate diagnostics.

Change-Id: Icc8767607cc17dc14d6227b07f34e81ba5525a96
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-01-24 14:41:48 +00:00
Nikolai Kosjar
e4e6572661 CppTools: Allow interpreting ambiguous headers as C headers
...instead of C++ headers.

For the Clang Code Model this results in using "-x c-header" instead of
"-x c++-header".

This introduces a new option in Options > C++ > "Code Model" to
configure this.

Change-Id: I8a0ce8fa6155f5ef58743ebc7f1d0b500fbf6599
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2017-01-16 10:17:50 +00:00
Nikolai Kosjar
9861a58400 CppTools: Prioritize project parts with selectedForBuilding=true
...when selecting one for the editor document.

This flag is only set by the QmakeProject.

Change-Id: I648886e12148bd1ebeccca52d9faaf4b528597c9
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-19 09:21:19 +00:00
Nikolai Kosjar
602c873d3e CppTools: Reparse editor documents after active project change
Change-Id: I010709c866291bf59c27f4a05765e1ab0efd28af
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-16 13:56:31 +00:00
Nikolai Kosjar
566ab175b3 CppTools: Prioritize project parts from active project
...when selecting one for the editor document.

Change-Id: I85066aaa0862870cb2db2fb2cb40c2b2c23b2cac
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-16 13:56:16 +00:00
Nikolai Kosjar
ce1c6b2258 CppTools: Extract ProjectPartChooser
...and put it under tests.

Change-Id: Id4bd2391abd1dfdc23640e871453558566cb0693
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-16 13:40:23 +00:00