Commit Graph

122 Commits

Author SHA1 Message Date
Jarek Kobus
c67dc5e8d4 All Plugins: Use global future synchronizer
Instead of using plugin's own synchronizers. The global
synchronizer does the synchronization just before all the
plugins' destructors run (in sync), so this should be
the right equivalent.

Change-Id: I8d09c9ea4a11b7a703684ad5319191ce310d992e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-04-25 13:45:39 +00:00
Jarek Kobus
5ff073df19 DiffEditor: Use QtConcurrent invocation for async tasks
Change-Id: I06640837ffee830e60e8dd2a566f9388f8444010
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-03-09 11:53:18 +00:00
Jarek Kobus
69ec9c4361 TaskTree: Add TreeStorage::operator*()
Reuse it in some places.

Change-Id: I335f38fa0384ea17bd8e981d743f835c3f05b731
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-02-21 07:31:48 +00:00
Jarek Kobus
202b696677 DiffEditor: Fix a crash when "No difference"
It may happen that async task associated with diffing one pair
of files may not report any value. This happens when both
file contents are the same. In this case taking a result from
async task on a successful done will lead to crash.

Add AsyncTask::isResultAvailable() method. Use it in client code
just in case, where needed.

Fix DiffFilesController, so that no result is allowed for all
running tasks (i.e. make the main group optional).
Collect list of optional results instead of direct results.
The empty optional on the list means the result wasn't delivered
by async task and it's skipped.

Fixes: QTCREATORBUG-28750
Change-Id: I4ca678a187fad619bae470da3e806e8c8da61127
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-02-03 15:31:25 +00:00
hjk
118b84ffd6 Use simpler Plugin::initialize() when feasible
Change-Id: I567965d266f20526bda9f823e31a04b354d53fb1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-20 12:13:10 +00:00
Alessandro Portale
16ec720537 DiffEditor: Tr::tr
Change-Id: I71b9908ea332256044120b42ff6af2fc57a89a5e
Reviewed-by: hjk <hjk@qt.io>
2023-01-19 15:32:29 +00:00
Jarek Kobus
a661dc5db4 DiffEditorPlugin: Avoid code repetition
Change-Id: Ie78bb992ff145a970e1cc03f59f228851fd43b08
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-01-12 13:44:51 +00:00
Jarek Kobus
1ef673cb2e DiffEditorPlugin: Remove unused includes
Some includes are not needed anymore after recent refactorings.
Inline simple constructors.

Change-Id: I1a4b192b8e6014a6af9ce9f87015fa10ee0ea33f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-01-12 12:38:11 +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
d59eca8577 DiffFilesController: Reuse task tree
Change-Id: Ia83cd81dc3dad671c7ec72cdffe882775c7e4508
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-15 20:56:04 +00:00
Jarek Kobus
d81abf1fb4 DiffEditorPlugin: Expose plugin's future synchronizer
Change-Id: I208a0e6b9c9776486972177f845e76d33121a2a3
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-11-09 17:47:02 +00:00
Jarek Kobus
daa942393a DiffEditorPlugin: Introduce DiffFileInfoArray
Change-Id: I884d72e6c500e41969f379d969bcf1f46be8fd5c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-29 16:14:04 +00:00
Jarek Kobus
b67c868f75 PatchTool: Introduce PatchAction enum
Add static PatchTool::confirmPatching() and reuse it
in two places.

Use Tr::tr() inside PatchTool.

Change-Id: I70779619dbb58ab6e46a585bbeff51588ccb2f53
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-29 15:15:30 +00:00
Jarek Kobus
38b19bfae6 DiffEditor: Cleanup includes
Change-Id: Id8127b9b0c99ee2a0d5d367cb551a1d5779c5d38
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-29 15:15:12 +00:00
Jarek Kobus
0def7c83d4 DiffEditorPlugin: Various cleanups
Change-Id: Ic0c9c397067b899932bc39d938e63df36fa4caeb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-28 18:10:02 +00:00
Jarek Kobus
91c4e06712 DiffEditor: Use DiffSide enum inside ReloadInput
Change-Id: Ib81eebdaf58686f27e8663787be5974aab46ce22
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-28 15:48:40 +00:00
Jarek Kobus
f3a7299761 DiffEditor: Use DiffSide enum inside FileData
Change-Id: I4c18c52a9737cc46c3faeadf0abd5c4771463e0e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-28 15:48:34 +00:00
Jarek Kobus
a1c4d563a1 DiffEditor: Use DiffSide enum inside RowData
Change-Id: I5511e443e2f76a1dab5cc78eec5faec04ee31bcc
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-28 15:48:16 +00:00
Jarek Kobus
cd8ff54b00 DiffEditor: Use DiffSide enum inside ChunkData
Change-Id: Ic10fe9faa6b6ccefcbf4c062663dedefa6bf5872
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-28 15:48:08 +00:00
Jarek Kobus
054d7d65d2 UnifiedDiffEditor: Move showing diff into separate thread
Before, when all the data was finished, we called showDiff()
in main thread. This consisted of 2 parts:

1. Calculating some extra data and generating actual text
   for UnifiedDiffEditor out of input data.
2. Calling setPlainText() with generated text.

For a really big diffs this could freeze the main thread for a
couple of seconds. Like e.g. 05c35356ab
(initial Creator import) - it contained 7 million characters,
part 1. took about 500 ms and part 2. took about 2.5 seconds.

This two tasks are now done in separate thread.
However, since we can't call TextEditorWidget::setPlainText()
directly from non-GUI thread, we create a separate
TextDocument object in the worker thread, fill it with
generated diff input and move the TextDocument object
into the main thread as a result of async computation.
In main thread we replace TextDocument object of the
TextEditorWidget with the one generated in other thread.
This replacement is very fast.

Change-Id: I49a717ced1dc2d5b8946e0fd6bee244b25071f35
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-28 15:47:39 +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
457fe4eb87 DiffEditor: Drop Utils:: prefix when using namespace Utils
Change-Id: I640447bcd90bba4281b2b945f53c54040060d3bc
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-08 09:16:42 +00:00
Orgad Shaneh
be1f89c93c DiffEditor: Fix git diff parsing for rename + mode change
Sample output:
diff --git a/projects/cosign/build.sh b/projects/argo/build.sh
old mode 100755
new mode 100644
similarity index 88%
rename from projects/cosign/build.sh
rename to projects/argo/build.sh
index 87d865d2..14b8885c
--- a/projects/cosign/build.sh
+++ b/projects/argo/build.sh
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
 ################################################################################

+$SRC/cncf-fuzzing/projects/argo/build.sh
+

-compile_go_fuzzer github.com/sigstore/cosign/test FuzzGetPassword fuzz_getPassword gofuzz

Change-Id: Ifa66dfdb80b309d72f524f15c681823ab7e133ba
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-02-07 12:56:40 +00:00
Eike Ziller
c6fdb66b2b Collect Qt Creator debug menu items into common submenu
instead of spreading them over the place.

- rename "Logger..." to "Show Logs..."
- create "Tools > Debug Qt Creator" menu and put "Show Logs", "Inspect
Language Clients" and "Inspect C++ Code Model" there
- add missing ellipsis

That gets rid of the otherwise not useful "Language Client" submenu, and
creates a nicer place for the "Show Logs" item.

Change-Id: I2588b4c93327669579979dfbfce37005ada29dab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-01-26 12:59:21 +00:00
Jarek Kobus
b6a996a8d5 DiffEditor: Assert that we are operating on non-null documents
Task-number: QTCREATORBUG-26594
Change-Id: I4331c457a6360682229dbbbfd8ac3d50b44b8ead
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-12-07 08:36:56 +00:00
hjk
8885ef7e5a Utils: Pass dialog parent to Utils::* file dialog
Amends 3edc5673b5.

Turns out quite a few potential uses have other parents than
ICore::dialogParent().

Use a nullptr parent to mean ICore::dialogParent() to keep the
caller side simple.

Change-Id: Icfe1daafd710ae273d286679e0c8e2a3a27da552
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-17 12:54:08 +00:00
hjk
b8f369c436 Use the new file dialog wrappers in some places
Change-Id: I326c883f2f76593e6fcb0f3e376d387273312982
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-06 08:56:51 +00:00
hjk
76db1e3746 Core: Add FilePath based overloads to EditorManager::openEditor{,at}
Part of the overall FilePath migration. Keep the original version for
a while to allow using code to catch up.

Change-Id: Ia7c5ea14416a06e679e8661c0e4045981db87b9b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-25 09:55:50 +00:00
David Schulz
8b7a90ac51 Utils: filepathify TextFileFormat
Change-Id: I6a4e2d38b0bbdec661a4a492901d9182a9f2e502
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-18 12:35:49 +00:00
Alessandro Portale
b2a766a79a Don't access static functions/fields via instance
Courtesy of readability-static-accessed-through-instance

Change-Id: I71f54244f1e091315dac2943d9e1bfad6efa56a9
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-11-19 08:42:14 +00:00
David Schulz
339db00f85 Core: replace QString with Utils::FilePath to get documents
Change-Id: I01777c227398be8bd3bf877c5429b84a75aa361b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-09-04 10:14:14 +00:00
hjk
b22768e980 Diff/Vcs: Use a function object for reloading
Helps with slimming down the user code side.

Change-Id: I4b0aac76c0d1516eb05bff9c18594e64f8b41a7a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-02-06 11:21:59 +00:00
hjk
ca89d1b8a6 DiffEditor: Pimpl plugin
The standard pattern, and allows to drop the QObject parent on
the editor factory which gets into the way of de-QObject-ifing
the IEditorFactory hierarchy.

Change-Id: I5c6a50f8075a99592ed4459b417ca8ba7471ae96
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-02-06 09:47:00 +00:00
Jarek Kobus
3b9ce98865 Git/DiffEditor: Fix staging added/removed lines separately
Fixes: QTCREATORBUG-23243
Change-Id: Ice19e1c778aabd9cb1b9fe0681234073de85cfcb
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-12-02 15:49:03 +00:00
Andre Hartmann
1766832918 DiffEditor: Stage and unstage selected lines for Git
Fixes: QTCREATORBUG-19071
Change-Id: I560ba208e68e477ea865e499847d819cfdfeb6f3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-11-19 11:19:43 +00:00
Alessandro Portale
cce6975fd8 DiffEditor: Modernize
modernize-use-auto
modernize-use-override
modernize-use-equals-default

Change-Id: I4e70550ed2962781b62661a405517b5c79126bad
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-11-09 05:40:27 +00:00
Ivan Donchevskii
5c658ac968 Beautifier: Move formatting tools to TextEditor
Formatting is moved from Beautifier plugin to formattexteditor.h/.cpp.
Diff and Differ classes are extracted from DiffEditor to Utils
to prevent extra TextEditor dependencies.

This change will make possible to use formatCurrentFile
and similar functions not only from Beautifier code.

Change-Id: Ic5ca668afe88f4e9376d49e6bd3594807172b0dd
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-08-30 11:01:08 +00:00
Jarek Kobus
d892eaadae DiffEditor: detect binary files
Task-number: QTCREATORBUG-15767
Change-Id: Ic9f513ecaeb15b56c90933b1d5e4cf70e045b481
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-06-07 06:57:31 +00:00
Jarek Kobus
7d60710608 DiffEditor: fix various warnings
Change-Id: I555aa30c8925ba8eeb314dd836f1544b93d7a66f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-05-03 13:03:31 +00:00
hjk
abe57f73b4 DiffEditor: Remove unneeded used of global object pool
Change-Id: I7b1cd980702313e3ef2501519aa64042d4483bb8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-02-08 08:32:01 +00:00
David Schulz
0eb7bab20c Core: make useMacShortcut constexpr
Change-Id: I293b96428784b6efecac6dae4f2f9690af0027da
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-02-02 13:15:55 +00:00
Orgad Shaneh
b8ee51fef1 DiffEditor: Simplify makePatch tests a bit
Change-Id: I205bda692dbb5f759ca84dd5cf4b73da9601a7b5
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-01-17 09:13:29 +00:00
Andre Hartmann
aae3056b33 DiffEditor: Modernize
* Use member init
* Use nullptr
* Use range-for
* omit QLatin1{String|Char} where possible

Change-Id: Ib231b747cdd9073b3d4fc6779b8e0afb2b404a31
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2017-12-09 14:45:37 +00:00
Orgad Shaneh
63861c44c1 DiffEditor: Fix parsing of mode-only change in patch
If one of the files has mode-only change, the entire patch
fails as a git patch, and is parsed as a text patch.

Because of that, the prefixes (a/, b/) are not stripped and
jumping to a change by double-clicking does not work.

Change-Id: Ib54ce4fa7aad02cb956af1f7de73d3c732ac5a89
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2017-11-27 11:40:31 +00:00
Jarek Kobus
6213369675 DiffEditor: Fix saving diff containing new or deleted files
Fix also the case when new file was empty.
Fix some const correctness.

Change-Id: Ied71c3de0398914e595fbf542f1b8ec3659d69b6
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-08-10 16:59:54 +00:00
Jarek Kobus
0b1eaacabb DiffEditor: fix the cancellation of diff requests
Change-Id: I36c4af4ec51473fb9da5d9f099f2251f75b2020a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-07-17 09:32:28 +00:00
Jarek Kobus
f07fda598e Replace QRegExp with QRegularExpression
Use QStringRef where possible.
Speedup readGitPatch() approximately 2 times.

Change-Id: I7bd09d7ac768331b0600456e48c44cfc72b7001d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-06-28 08:38:50 +00:00
Jarek Kobus
9774f11738 Support diff a file from project explorer against the current file
Task-number: QTCREATORBUG-9432
Change-Id: Ie370bbffdb67dac520f392a73c1358f887157806
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-03-28 14:36:54 +00:00
Jarek Kobus
8b67458a95 Prefix editor's uniqueId with plugin name
In this way we minimize the chance of
generating non-unique id.

Change-Id: Idd177c5a4b44b17a58c2a944ec77b9517e91964e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-01-10 15:14:19 +00:00
Orgad Shaneh
7b3642cce4 Merge remote-tracking branch 'origin/4.2'
Change-Id: I259a402bc896fc2e359cc96b7510453ac9a9a552
2016-11-28 15:27:51 +02:00