Commit Graph

106 Commits

Author SHA1 Message Date
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
Jarek Kobus
78c3590705 Make skipOpeningBigTextFile() public and use it in Diff Editor
Change-Id: I5e98d1ab93ac442c1f1a132a51ab838567a735a0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-11-23 14:08:38 +00:00
Jarek Kobus
2144fb5949 Move diff calculation to the separate thread
It doesn't freeze creator anymore.

Task-number: QTCREATORBUG-14255
Change-Id: I3d06ea7a848e321c6072e00a73b96e9ea9770b6a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-11-21 15:43:03 +00:00
Jarek Kobus
fd460a11dc Add some missing consts
Change-Id: I1c5122b893e7255237310562fcad16bc53f15fd7
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-17 10:31:27 +00:00
Jarek Kobus
8c36249ffa Add missing overrides
Change-Id: I7e27a273044542537423c8f4b9ab5235c3fabc22
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-17 10:31:18 +00:00
Jarek Kobus
8224c1c95d DiffEditor: fix revert chunk for diffs of modified files
Apply chunk action doesn't make sense for that case,
will stay disabled.

Task-number: QTCREATORBUG-17136
Change-Id: Idce31b3aa9d354536a01607c10b20273158961d5
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-21 09:49:08 +00:00
Jarek Kobus
d3a743d77e Use namespace Core in diff editor plugin
Change-Id: I2409a6186d590a83ccde064c855e0261d600014e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-21 09:20:35 +00:00
Jarek Kobus
4ae306a5e1 Handle "Diff All Modified Files" action enablement
Also rename it to "Diff Open Files".

Task-number: QTCREATORBUG-17094
Change-Id: I370c32497fcb56cb2bd84700ef7cb4aa7ba0a573
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-21 09:20:29 +00:00
Jarek Kobus
1414826183 Implement diff on close, on revert and on external modification
Task-number: QTCREATORBUG-1531
Change-Id: I8c9a740d66eb7836b3df6850ac243260fd282b32
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-21 09:20:20 +00:00
Christian Stenger
ad615ece16 DiffEditor: Fix compile with gcc 4.8 / Qt5.6
Broke with ee095ef5d5.

Change-Id: Ib8cc5a0b8d79cf6ca542eb2fc9c0a4f06e885d88
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-10-07 05:31:58 +00:00
Jarek Kobus
ee095ef5d5 Implement diff for unsaved changes
Task-number: QTCREATORBUG-9732
Change-Id: I7e0f1d18046451ac1bc84b8c28113d72f63642a8
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-06 14:14:03 +00:00
Jarek Kobus
adbc3f611f Show proper diff when one of diff files is missing
Task-number: QTCREATORBUG-16540
Change-Id: I185ac8e7c8be364c1e2f74bfe0af6f9e393c89be
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-07-25 13:29: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
Nikita Baryshnikov
5398f4f5b1 fix metatype declaration in a few places
Change-Id: I76a12a278db8e74d935e76a5e832daf8e34df2a9
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-09-02 08:48:20 +00:00
Orgad Shaneh
d618c05e3a DiffEditor: Support mode change in Git diff
Task-number: QTCREATORBUG-14963
Change-Id: I5d26ae810add657a94fb40a5d4437e2d17a1625a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
2015-08-25 06:48:49 +00:00
Christian Kandeler
ccbc7f9ec1 DiffEditor: Silence warning about unused variable.
Change-Id: I18a6dd021bb29ca5eaa7727213c80458d903ee6c
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2015-06-10 12:59:53 +00:00
Nikita Baryshnikov
147dad8944 DiffEditorManager simplify
by using EditorManager::openEditorWithContents

Change-Id: I2850648bff0f5b8f01254b9c7ce9539c1262f576
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-04-13 12:33:01 +00:00