Commit Graph

65 Commits

Author SHA1 Message Date
Artem Sokolovskii
028686b419 ClangFormat: Grey out Clang-Format Style config when not overridden
Add feature to grey out the Clang-Format Style configuration widget
after unchecking the 'Override' checkbox.

Change-Id: I94bbb1f4436f3caeaed55d49582211257e480d0d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-04-06 11:20:29 +00:00
Alessandro Portale
389b9503d7 ClangFormat: Tr::tr()
Change-Id: Iabbe39bfdd3ae24d65610a00d792e16591a1b6ee
Reviewed-by: hjk <hjk@qt.io>
2023-02-08 11:09:12 +00:00
Christian Kandeler
93201df992 ClangFormat: Pimpl ClangFormatConfigWidget
Task-number: QTBUG-110780
Change-Id: I4039db916276c84660775a2cdd4e4538df784329
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-02-01 10:24:36 +00:00
Artem Sokolovskii
42c3e88f95 ClangFormat: Move the functions from clangformatutils
- Moved the functions from clangformatutils to the places where
it is belong

Change-Id: Ia4108c5b096610170e0f9d16d15d40d5538ffbdc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-17 09:00:56 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Artem Sokolovskii
2ffa843d40 ClangFormat: Make clang format checks widget resizable
- Change Form to Grid that looks consistent for
different OS

Change-Id: Ibb5fc3564d8c25457c4bf520acf78b25c542b5ae
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-16 12:15:32 +00:00
Artem Sokolovskii
0b9711b9c5 ClangFormat: Get rid of ui files
- new clangformatchecks files are generated based on
utils/layoutbuilder

Change-Id: Ie376755abc632083898e44ea57d2ff8600e47f34
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-12-07 09:26:11 +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
Artem Sokolovskii
2d375eb776 ClangFormat: Move override checkbox to global settings
Moved override checkbox to global settings groupbox.

Change-Id: I70c97486a61f69274d059edc5095fe02c86fb04d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-08-24 15:11:40 +00:00
Jarek Kobus
71f0597e49 ClangFormatConfigWidget: Avoid using sender()
Use Utils::Guard instead of Utils::ExecuteOnDestruction.

Change-Id: I7f2be9c3864d9cac31423353d46dfa98660dd0af
Reviewed-by: hjk <hjk@qt.io>
2022-08-22 10:11:01 +00:00
Artem Sokolovskii
74ac09346f CodeStyle: Remove edit pop-up
Removed the Edit pop-up on the CodeStyle page.
Now editing is available immediately after opening
CodeStyle tab.
I left a preview on the project CodeStyle page and
added a link to global settings.

ToDo:
In project CodeStyle page replace preview with CodeStyleEditor.
I'm not 100% sure that it is needed. If you have some thoughts
please write a comment.

Change-Id: I31032a97b9668b4f6b06fc6c5c704700fb44ee4f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-08-16 11:49:19 +00:00
hjk
031bf8d3a4 ClangFormat: Inline *.ui files
Change-Id: Ie6bcb486c70896894121434b1030861b029a46a2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-08-05 11:55:28 +00:00
Artem Sokolovskii
e572bdd90c ClangFormat: Move global settings in main page
The settings: indenting instead formatting, format while
typing, format edited on file save are moved to Code Style
page.

Change-Id: I28787b44602ce288961c778fe704ad2a1a05913f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-08-05 09:41:14 +00:00
Artem Sokolovskii
80b4e6a910 ClangFormat: Update clangformatchecks.ui file
File updated by scripts/generateClangFormatChecksUI.py

Fixes: QTCREATORBUG-27952
Change-Id: Ib7ffbf1f416a4edffc130a00ae8348d2ac9ed010
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-07-28 13:09:38 +00:00
Jarek Kobus
683ad910b8 Drop Qt5: Clang, QBS & Valgrind: Get rid of QOverload
Change-Id: I86697f07a8dce5674d6e748bce807df59b773227
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-07-20 13:13:27 +00:00
Artem Sokolovskii
2f18256633 Clangformat: Brings back some of checkboxes
Brought back checkboxes: format while typing, format on save.
Brought back format while typing feature.
Global checkboxes will be hidden in project settings,
and visible for global.

Change-Id: I193cf9e13b10de22091edb5fe04aef957dd74586
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-30 10:36:49 +00:00
Artem Sokolovskii
0b6fca2293 ClangFormat: Add disable option
- Added a possibility to disable ClangFormat plugin
- Removed unneeded properties from clangformatsettings

Change-Id: If71f46670e4fd3d2dac6d18c97df5a811504ed5e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-19 11:58:45 +00:00
Artem Sokolovskii
e30652ae55 ClangFormat: Build fix Qt 5
Change-Id: I5afec32314263dfa9db6f36b8871b43fde47f698
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-05-16 09:51:38 +00:00
Artem Sokolovskii
b634ec77fc ClangFormat: Fix override checkbox doesn't affect behavior
Override checkbox allows use clangFormat settings
from widget even if there is .clang-format file in
file's folder or parent folder.
It works for global settings and for project settings.

Change-Id: I03152f4b0e1b62b3ac038024e76cc9082fa37ec3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-16 07:00:07 +00:00
Artem Sokolovskii
72dd90e512 ClangFormat: Start to use new file management
- Indenter uses .clang-format file from a dir of
editing file or from a parent dir. If there is no
such file then indenter starts to use file from a dir
with the name current CodeStyle settings.
- Test fixed

ToDo: Add file absentness processing in case of import

Change-Id: If09ef0c598899856b948c214e524bcfd5dad76e2
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-04-20 07:52:17 +00:00
Artem Sokolovskii
7574ec3e21 ClangFormat: Add the logical settings management
Now there are changeable and unchangeable settings,
as it works for usual codestyle settings.
They save parallel with codestyle settings but in another dir.
In general, the behavior became similar to usual codestyle settings.

ToDo: Make indenter use this settings instead standard one and
instead project settings when "override" checkbox is checked.

Change-Id: I639dbda296932bf9b967a11f1cc4fda120415ed9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-04-11 14:03:22 +00:00
Artem Sokolovskii
059d20ed22 ClangFormat: Fix unsaving properties for global settings
- Fixed behavior "Formatting mode" combobox settings isn't
saved after pressing "Ok" button when no one project is
open. Now it works as expected, settings save after press
"Ok" button.
- Added additional applying interface for ICodeStylePreferenceFactory
which allows pass-through apply call from dialog to the editor.

Note: it doesn't work with read-only code style profiles

Change-Id: If4f0c85e3105550db4ffd9860e94b678f0d9b386
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-03-30 16:32:08 +00:00
Christian Stenger
de88d00ca4 ClangFormat: Fix build with Qt5
Amends 4022ed547d.

Change-Id: I66fc822443c8353209446cf7973a3db9dc52debe
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-03-28 09:00:23 +00:00
Artem Sokolovskii
4022ed547d [ClangFormat] Remove redundant checkboxes
- Removed redundant checkboxes
- Removed apply button
- Combined checkboxes to combobox

ToDo:
- Specify behavior for global and project settings

Change-Id: I39a00ac8439ae7be3041890f7fc882849685d102
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-03-25 14:17:48 +00:00
Artem Sokolovskii
a997161dd6 ClangFormat: Synchronize ClangFormat settings with CppEditor codestyle
Added synchronization between ClangFormat codestyle settings and
CppEditors codestyle settings. All changes which will be done in
ClangFormat settings tab settings tabs will be automatically
retranslated to CppEditor codestyle settings tabs and vice versa.

Change-Id: I408d726c12552856e3c1b72d3ba09b77fff83321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-11-24 21:35:31 +00:00
Artem Sokolovskii
d02155f24a ClangFormat: Fix bug with reload of settings
- Fixed behavior when saved data from file doesn't load
in the first opening of the code style options

Change-Id: I1c72845cbf8119f9eb402a2f40bcc816c5590c25
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-10-06 13:17:04 +00:00
Artem Sokolovskii
8b263b4ae5 ClangFormat: Rework clangformatconfigwidget
- Move logic work with clang-format file to
additional class to make clangformatconfigwidget
responsible only for work with ui elements.
- Fix functionality: when new BasedOnStyle was
chosen all fields were empty or set in default,
now it fills with the corresponding value.

Change-Id: I2ee42a502e87da761274d293a7f0a38fda98804d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-10-06 06:59:17 +00:00
Christian Kandeler
284817fae6 Merge CppTools into CppEditor
There was no proper separation of responsibilities between these
plugins. In particular, CppTools had lots of editor-related
functionality, so it's not clear why it was separated out in the first
place.
In fact, for a lot of code, it seemed quite arbitrary where it was put
(just one example: switchHeaderSource() was in CppTools, wheras
switchDeclarationDefinition() was in CppEditor).
Merging the plugins will enable us to get rid of various convoluted
pseudo-abstractions that were only introduced to keep up the artificial
separation.

Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-01 14:53:58 +00:00
hjk
8e352af0ec Core: Add a default parameter to various ICore::*path functions
Saves some code on the user side.

Change-Id: I32cd220b6e533f5497a1865f9c34ab9db4cfda79
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-04-27 06:52:05 +00:00
Eike Ziller
c1f90aeca2 ICore: Change some path API to use FilePath
Change-Id: Id841d6177206a021c9e606ce560b47d1ae6e52b9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2021-04-26 08:03:47 +00:00
David Schulz
4070d6a289 Editor: add formatter support
Change-Id: I65590273b2541e08a39970cd9bb4739a5634b2f7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-01-22 06:00:11 +00:00
Orgad Shaneh
2aca0c1b28 Fix MSVC warnings
* Missing `this` captures
* Implicit size_t -> int conversion
* Unused argument
* Suppress warnings in clang headers

Change-Id: I7083ce6ab22ee22ecc1258539e77c790acc78df1
Reviewed-by: hjk <hjk@qt.io>
2019-09-11 15:20:34 +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
Eike Ziller
e0b0a08e50 ExtensionSystem: Move away from QList
Qt 6 API will move away from it.
Use QVector for API and some std container for internal things.

Change-Id: Iff14d48a47d5ac52ade875d9c8c84ad8a4f577d8
Reviewed-by: hjk <hjk@qt.io>
2019-05-27 14:21:00 +00:00
hjk
dc9cbd8f57 More FileName::appendPath() -> .pathAppended() changes
Change-Id: Ibc7eb4eb3ffb64658e441aafa240b1ddc0061930
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-27 09:10:19 +00:00
hjk
1e9636ab8a Some more FileName::appendPath() -> pathAppended() changes
Change-Id: Ie494f7ae8a96d97c9497b3ef38d774d2cf787b7f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-17 07:46:56 +00:00
Ivan Donchevskii
1ae98c3595 ClangFormat: Add the interaction with Beautifier
Do not allow ClangFormat plugin to format on file save
when the Beautifier has the same checkbox selected.

Change-Id: I655d77a888cc444ccb02c4e72f11a93b3ab9bbd5
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-04-29 12:32:31 +00:00
Ivan Donchevskii
c2ab89cc12 ClangFormat: Do not reinitialize the configuration and preview
Initialize them only once and only show/hide widgets later on.

Change-Id: I5ebad504709e34aeb6ce5bf1ead7d8e2ee0b2056
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-04-29 11:22:12 +00:00
Christian Stenger
75112c4b59 ClangFormat: Fix compile with older gcc and MSVC
Amends 2d8ce380c9.

Change-Id: I44e7079ae40550e4d80a1717d4803d6864af99eb
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-04-29 06:08:47 +00:00
Ivan Donchevskii
2d8ce380c9 ClangFormat: Fix UI issues
- 'Default' values remain so after save/load
 - the language is fixed to C++
 - the project settings are shown correctly
 - fix parsing configuration file
 - do not trigger slots when we fill the table

Change-Id: I91b477721b5084803324cd38d0cfeb9d5650dd9f
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-04-26 07:55:00 +00:00
Ivan Donchevskii
e9d443b1c7 ClangFormat: Improve the configuration UI
Use QComboBox, QLineEdit and QPlainTextEdit to edit
different option types.

Show changes in the preview without pressing 'Apply' button.

The clangformatchecks.ui file is generated with the python
script that is a part of this commit.

Change-Id: If5ff0acab6edd74f2e087e31fbd3ad1b9f847030
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-04-25 07:52:48 +00:00
Ivan Donchevskii
d46ce1705f ClangFormat: Show the global fallback style
Fixes: QTCREATORBUG-22144
Change-Id: I201dbccb8b1f1738451f760af34cf588afb5f4d5
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-04-25 07:51:34 +00:00
Ivan Donchevskii
17f87a6d82 ClangFormat: Disable configuration UI instead of hiding
This is the first step without strings change.
The next step is I201dbccb8b1f1738451f760af34cf588afb5f4d5.

Change-Id: Ic0ce6a5ab3e74303a71a7c0bd8188d0284a241eb
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-04-03 12:02:31 +00:00
Ivan Donchevskii
c1d03e610c ClangFormat: Fix showing the warning text
The call to show() was lost at some point, let's restore it.

Change-Id: I83f551d26e6c4f658426b1196ff3a0935aea7047
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-04-02 11:31:35 +00:00
Ivan Donchevskii
0abcf7b618 ClangFormat: Fix path for the overridden project configuration
Change-Id: I4748c994016851293a6ad5490208fb4e4bbc7999
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-03-06 15:07:49 +00:00
Ivan Donchevskii
5bb8e67846 ClangFormat: Do not save settings if they are not overridden
Apply only settings from checkboxes in that case.

Change-Id: Ic6740ab9d769730bba4d04dcdde7ad1e2a464614
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-03-06 08:43:28 +00:00
Ivan Donchevskii
bf972bcb01 ClangFormat: Change the logic how configuration is picked
Let's use by default the configuration that clang-format picks itself
for the source file. The Qt Creator configuration will now only
override the default one with global or project settings and can be
turned off with the checkbox.

This behavior is clearer than always picking some configuration
which Qt Creator prefers best.

Change-Id: If5ed3d67eb6b4b47a6d0fd5259f7efbb608914d1
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2019-03-05 14:48:59 +00:00
Orgad Shaneh
a53032d6a5 CppTools: Move code style snippets to a separate header
Include it only where used.

Resolves many "unused static variable" warnings.

Change-Id: Ie1e578d9b9511f963e359d87f7740b4981975dbd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-02-26 06:06:51 +00:00
Ivan Donchevskii
956543e462 ClangFormat: Add the preview text editor to the settings
Allows the user to see how the current style applies to
the code snippet. The action is triggered by the 'Apply' button.

Change-Id: I820d989519cfdfb6e617ed6e8e9e5751be6619ea
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2019-02-22 14:31:05 +00:00
Ivan Donchevskii
c6b58a063f ClangFormat: Show .clang-format file as text instead of the table
Change-Id: I8b912ec6f29dfe7059ac6ab3888a6c3698769fc1
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-02-22 14:30:56 +00:00