Commit Graph

114 Commits

Author SHA1 Message Date
Eike Ziller
f7c7cd0ae9 Find: Avoid saving default values for advanced search
Change-Id: I69454675c15a9eb92d0665ea6f88f0969a532eb8
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-06-03 12:03:54 +00:00
Eike Ziller
f870e7ffdf FindFilter: Move settings saving to Store
This makes it possible to save it for the session instead/in addition.

Task-number: QTCREATORBUG-793
Change-Id: I95bc20f4912a97863cb88849e32699a689ba6f3f
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-06-03 12:03:44 +00:00
Cristian Adam
ba4d9b8134 Core,PE,TE: Add "build" to find in files exclusion list
Now that we have the "build" directory in the source directory we need
to exclude it from the find in files search list.

Change-Id: I74b20f828ffed51b5d7be98efa662bcc4b420523
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2024-05-03 07:52:00 +00:00
hjk
524167a936 TextEditor: Use new setup pattern for the finders
The FindInFiles definition cannot go yet to the .cpp yet as there
are some exported functions.

Change-Id: I2d2f02ae80b560e3147f461fcbee0fa62b8085a3
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-01-29 13:01:39 +00:00
hjk
016936a450 Clean up some lambdas
Change-Id: Id947c0935b1aa4579e1c64d3e510db41103fbe27
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-12-12 10:55:32 +00:00
Tasuku Suzuki
8d21274b28 FindInFiles: Add button to select directory from current document
Enhanced UI by introducing a button for users to easily set the
directory of the current document to the search path, addressing the
limitation of the existing 'Browse...' button.

Change-Id: If33f5c34428224ceb8854794b0dc222d588429cb
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-09-29 11:48:50 +00:00
hjk
60d1fe4cb7 All: Even less #include <QSettings>
Change-Id: Ifbb2af34169036236e6f2f7b09ef115de5c6a6c7
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-09-27 14:10:07 +00:00
hjk
342e066886 Utils, all: Standardize on QtcSettings
Change-Id: Id222016f15b1c3bfe6710fe5d0297666d4565ef1
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-09-27 13:25:31 +00:00
hjk
c7710acadd Utils: Use Key more widely in QtcSettings
And adapt user code.

Change-Id: I6efe4ebe6823de4cc862f304a57e041b02c40eac
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-30 07:38:02 +00:00
hjk
2bf886ed73 Utils: Use a bit more Key and Store
Also, separate the Key into a separate header to minimiz impact
on #include load.

Change-Id: I4f719cad4d23a71a9c228d0b7f5c2409fd6e24d5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-24 05:58:05 +00:00
Jarek Kobus
714b5963f7 BaseFileFind: Some cleanup, also in derived classes
Change-Id: I1fb3d3937543f9c4fd8ca723410494cfc76322ee
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-07-07 08:22:50 +00:00
Jarek Kobus
7a28ed76b8 BaseFileFind: Make searchDir() non-virtual
Replace FindInFiles::pathChanged() with
BaseFileFind::searchDirChanged().

Change-Id: I3cbe507968391fe45f513490424a7fe6fbbffee1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-07-06 18:45:26 +00:00
Jarek Kobus
bf09d17992 BaseFileFind: Replace additionalParameters() with searchDir()
The FileFindParameters::additionalParameters,
holding QVariant, was ambiguous. Since GitGrep and
SilverSearcher need a search directory input
unconditionally, replace the additionalParameters field
with searchDir of FilePath type. For Internal
search engine, this field isn't used - the searchDir
is already passed in FindInFiles::fileContainerProvider()
with lambda capture; for other BaseFileFind subclasses,
not combined with non-Internal search engine, the field
isn't used anyway.

This change closes the chain of patches to eliminate
the usage of ambiguous QVariant type inside FileFindParameters.

Change-Id: Icddd1cfe46e86ea892221862d9d267f9c9fa173c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-06 18:45:19 +00:00
Jarek Kobus
de5efffeff BaseFileFind: Replace files() with fileContainerProvider()
The fileContainerProvider() is called only once per
SearchResult instance, and the result (the provider)
is stored inside FileFindParameters.
In this way the extra data, like the name filters or
the search directory, are set just once. Whenever the
search is started (or started again), the stored provider
recreates the FileContainer according to the data that
has been captured by the lambda when the provider was created.

This patch eliminates the need for retrieving the custom
data from QVariant. It also eliminates the set of arbitrary
arguments for the removed files() method.

Remove the BaseFileFind * argument from the
SearchEngine::executeSearch() method.

Change-Id: I7211f503f82db12b5a99c9d342466daaaae0839f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-07-04 12:23:05 +00:00
Jarek Kobus
27302694ab BaseFileFind: Reuse FileContainer
Reuse it in BaseFileFind::files() and in
InternalEngine::executeSearch().

Change-Id: I2fed4e6af37e83d76deaa8d847564aa4950fc223
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-06-23 13:04:05 +00:00
hjk
17b20e0622 TextEditor: Tr::tr
Change-Id: I28aa68e25c53c3a4d1c370074d7b3318944dc45a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-01-18 07:02:12 +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
Jarek Kobus
3caf82f746 Remove unused includes of Q[H/V]BoxLayout
Change-Id: Ia90b30b634281414268e00722771470f1e7b69c0
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-11-18 15:29:06 +00:00
Eike Ziller
2456f8f568 Convert file search API to FilePath
Fixes: QTCREATORBUG-28135
Change-Id: Iec8fcbae40adcccbe775de5719a657f5aa30a941
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-12 12:24:48 +00:00
hjk
6f0f982356 TextEditor: Use filePath() instead of rawFilePath in find in files
The only consumer is gitgrep and doesn't expand the path by itself.

Change-Id: Ic05d29f82a6d277731439ffc032a79f7cbc6f496
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-09-06 08:18:02 +00:00
hjk
1567d24980 Utils: Replace PathChooser::{fileP,p}athChanged signals
... by a new PathChooser::textChanged signal.

They were both emitted in reaction to the underlying line edit's
textChanged() signal.

Use 'textChanged()' as name to mimic/match the Qt side. This also
makes it more clear on the user code side, when this happens.

Some textChanged() consumers should probably use editingFinished()
instead, but that's left for later changes.

Change-Id: Ib07347f616cbf1c5d09bc2f8671ca860d185d1f9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-09-06 05:01:51 +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
Jarek Kobus
44f1fd6498 Drop Qt5: Cpp/TextEditor: Get rid of QOverload
Change-Id: I010f211b40f876c0f033fd717aaa094f775ea214
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-26 16:58:45 +00:00
Artem Sokolovskii
66f132dd9b TextEditor: Remove foreach / Q_FOREACH usage
Task-number: QTCREATORBUG-27464
Change-Id: Ie9594bf661dbeecf22589c1580648252f0bfb7fb
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-05-19 07:33:27 +00:00
Alessandro Portale
fcf9537dc5 Various FilePath::fromString -> fromUserInput changes
Change-Id: Ic9c5e2f5c0375468651557f504b101572b72ac06
Reviewed-by: hjk <hjk@qt.io>
2021-09-23 16:28:54 +00:00
hjk
43b658e9e7 Utils: Drop Utils::SkipEmptyParts again
We require Qt 5.14 nowadays.

Change-Id: Iff245257d3cb19207007c0445ee13814e66152dd
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-21 12:42:27 +00:00
hjk
1c81a3b3e8 All: Use Utils::SkipEmptyParts
Task-number: QTCREATORBUG-24098
Change-Id: Iab45de9a9c17ddc39a0e343b1175d4f6cb94b098
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-17 05:55:25 +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
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
Sona Kurazyan
8e31932c29 Remove usages of deprecated APIs of QLayout
Replaced:
  QLayout::setMargin() -> QLayout::setContentsMargins()
  QLayout::margin() -> QLayout::getContentsMargins()

Task-number: QTBUG-76491
Change-Id: If28ef6910b3afe5d04e4746b74f9362a3e3b3c8e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-09-02 13:01: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
hjk
19e1cf1520 Replace uses of qVariantFromValue with QVariant::fromValue
Deprecated in Qt 5.14, alternative has been around since Qt 4 at least.

Change-Id: I4e3a53c289088368609e0d0ce2405a832d311308
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-05-27 12:33:29 +00:00
hjk
6f37348b4c Replace static_casts by QOverload where possible
Mainly to get rid of the QProcess::finished deprecation warning.

Also adjust coding style in the surrounding connects when needed.

Change-Id: I12f9b248c7974b892c4a069356e578e80f8c59e9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-02-26 15:18:14 +00:00
Tim Jenssen
a78e3e5dd5 use initializer lists
Change-Id: I82b04601f1db52197b3dc625b6b7e0f143c1c8b6
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-01-21 15:10:54 +00:00
Eike Ziller
9084ca73df Merge remote-tracking branch 'origin/4.8'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/plugins/cpptools/compileroptionsbuilder.cpp

Change-Id: I87f47cecbb924064296a002fd9446a0627acad8e
2018-12-12 09:44:13 +01:00
Eike Ziller
7a77ac5dd1 Do not search our own autosave files by default
When doing a "Files in File System" search. Also make sure that the
default filter is always available in the drop down.

Fixes: QTCREATORBUG-21541
Change-Id: Id8b315691b78e5d956cebf73067683dea8f8ca51
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-12-10 06:27:31 +00:00
Alessandro Portale
2e2059e8b5 TextEditor: Modernize
modernize-*

Change-Id: Ic497fea1942a77cf017be3b0033f92e3807066f1
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <hjk@qt.io>
2018-11-30 17:35:18 +00:00
Orgad Shaneh
41dee83bec TextEditor: Modernize
override, auto, nullptr, member initializers.

Change-Id: I04c6ebb683849568973bd7782fb5a3279267141e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-09-20 08:48:49 +00:00
Orgad Shaneh
3490e67a49 FindInFiles: Support relative path based on the current project
Task-number: QTCREATORBUG-18139
Change-Id: Icffbba7f9db4514b986f0414a9f7a834d4da39c6
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-05-19 07:34:33 +00:00
Eike Ziller
1f8b2dc361 Advanced search: Add exclusion patterns
All files with full file path matching one of the exclusion patterns are
ignored in the search.
Searching with "git grep" now requires git >= 1.9

Change-Id: Ied5d11499bc1ff21247e50f8e146e8e5011dd2c1
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-02-28 10:48:23 +00:00
Eike Ziller
57ca90b846 BaseFileFind/FindInFiles: Clean up enabled / valid state handling
IFindFilter:  Separate enabledChanged and validChanged
SearchEngine: Add enabledChanged
GitGrep:      Enable widget based on enabled state
FindInFiles:  Update validity on search engine enabledChanged instead of
              hardcoding it to when the search path changed

Change-Id: I0c684423b871a3a4f1f164574f42e23b64cf9da0
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-11-25 08:42:53 +00:00
Przemyslaw Gorszkowski
6b2cf5cd03 FindInFiles: make possible to have more than one extension
This change adds a possibility to add more than
one external tool which can be used instead of internal finder.
Currently there is one extension: 'gitgrep'.
By default we use internal finder.

Change-Id: If644358552f3cea9ebda8308539322a1b6d3ab77
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-11-16 09:52:05 +00:00
hjk
bcf7a11c24 Core: Apply 'static' pattern to Core::FindPlugin
Also, rename it to Core::Find. It hasn't been a plugin for a while.

Change-Id: I845885ccf18bdc1440258d523b033758d5583881
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-03-15 12:43:59 +00:00
Orgad Shaneh
558c08e2c5 Git: Hook grep into Find In File System dialog
Change-Id: I0fc77ad61c8874a21afd5b5135df4d30fa795a8e
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-02-04 11:58:29 +00:00
Orgad Shaneh
d01627bb01 TextEditor: Disable Search & Replace buttons when folder doesn't exist
In case of searching in scope: "Files on File System" when specified
directory does not exist, "Search" and "Search & Replace" buttons
should be disabled.

Task-number: QTCREATORBUG-5959
Change-Id: I1905cbea08aa07d72b96e9ad893ef3928d633c4f
Reviewed-by: Robert Loehning <robert.loehning@theqtcompany.com>
2016-01-21 12:30:14 +00:00
Orgad Shaneh
bf22f23066 TextEditor: Use PathChooser for FindInFiles
Change-Id: I17058cd41eec1cfea41ddbf2cae1a7c70a4e3a10
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-01-21 10:12:10 +00:00
Tobias Hunger
397e7f4843 Update License according to agreement with Free Qt Foundation
* Update files in src/plugins

Change-Id: Ia5d77fad7d19d4bb3498e78661982f68729adb22
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:57:01 +00:00
Orgad Shaneh
02c4f0dd88 FindInFiles: Use Utils namespace
Change-Id: I7f61ee40ecb84b594018a04062c702bb36ad4510
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-01-19 06:59:38 +00:00
Orgad Shaneh
9d3b2f0998 TextEditor: Use Qt5-style connects
The heavy lifting was done by clazy.

Change-Id: I380120e3419d2a3c0e272f51cc3e0d5f6aaa5e9b
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2015-12-18 11:54:12 +00:00
Leena Miettinen
17b892f8f3 TextEditor: rename "Files on File System" as "Files in..."
The current actually means "files about the file system".
Yes, I know it has been there forever and a day :).

Change-Id: Ica99118b902c9ba08a1434fc97820348b3312a87
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-11-10 13:37:23 +00:00