summaryrefslogtreecommitdiff
path: root/src/plugins/diffeditor/unifieddiffeditorwidget.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Utils: Rename asynctask.{cpp,h} -> async.{cpp,h}Jarek Kobus2023-05-031-1/+1
| | | | | | | Follows AsyncTask -> Async rename. Change-Id: I37f18368ab826c9960a24087b52f6691bb33f225 Reviewed-by: hjk <hjk@qt.io>
* Tasking::Async: Rename Async into AsyncTaskJarek Kobus2023-05-031-2/+2
| | | | | | | | | Rename Utils::AsyncTask into Utils::Async. Rename AsyncTaskBase into AsyncTask. Task-number: QTCREATORBUG-29102 Change-Id: I3aa24d84138c19922d4f61b1c9cf15bc8989f60e Reviewed-by: hjk <hjk@qt.io>
* All Plugins: Use global future synchronizerJarek Kobus2023-04-251-2/+3
| | | | | | | | | | 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>
* DiffEditor: Don't use QFutureInterfaceBase::get()Jarek Kobus2023-03-101-18/+17
| | | | | | | | | It's available only since Qt 6.3. Amends 5ff073df19b872b8db601f31e1124c6048a89a3c Change-Id: I38c8c3b0bc3c94612dee15614f00e83ebc86db04 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* DiffEditor: Use QtConcurrent invocation for async tasksJarek Kobus2023-03-091-24/+18
| | | | | Change-Id: I06640837ffee830e60e8dd2a566f9388f8444010 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* DiffEditor: Fix a crash when "No difference"Jarek Kobus2023-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | 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>
* DiffEditor: Tr::trAlessandro Portale2023-01-191-5/+6
| | | | | Change-Id: I71b9908ea332256044120b42ff6af2fc57a89a5e Reviewed-by: hjk <hjk@qt.io>
* Remove GPL-3.0+ from license identifiersKai Köhne2023-01-061-1/+1
| | | | | | | | | | | | | | | 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>
* MathUtils: Add tangential interpolationJarek Kobus2022-11-281-2/+2
| | | | | | | | Reuse it in TaskProgress and in ProgressTimer. Rename MathUtils::interpolate() into interpolateLinear() Change-Id: Iff4cda1e3b8782cd26277ec75046ca5526be92c0 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Move DiffUtils::interpolate into MathUtilsJarek Kobus2022-11-281-3/+3
| | | | | Change-Id: Iac4a21a6c760d8fbf0dce380b1a9a587a9d3468e Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* DiffEditor: Use AsyncTaskJarek Kobus2022-11-181-20/+13
| | | | | Change-Id: Id5b21b10c7a8805b560eb4fb36fd955b7af34afa Reviewed-by: hjk <hjk@qt.io>
* DiffEditorPlugin: Expose plugin's future synchronizerJarek Kobus2022-11-091-2/+3
| | | | | | | 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>
* UnifiedDiffEditor: Fix indent visualizationJarek Kobus2022-10-211-0/+2
| | | | | | | Add TextEditor::setVisualIndentOffset() protected helper. Change-Id: I0755a732d07dec651c090dd6afd87d293453f0e1 Reviewed-by: David Schulz <david.schulz@qt.io>
* SelectableTextEditorWidget: Handle display settingsJarek Kobus2022-10-201-26/+0
| | | | | | | | | | | Avoid code repetition inside UnifiedDiffEditorWidget and SideDiffEditorWidget. Connect to display settings changed signal and apply all but 4 settings (which are not desired for diff editor). Change-Id: If4ae7f7c55690dac04fd1a00f8822db666a9ce2b Reviewed-by: David Schulz <david.schulz@qt.io>
* UnifiedDiffEditor: Fix never ending spinner when no differenceJarek Kobus2022-10-131-1/+0
| | | | | Change-Id: If0d646c760cdc8c9fb8e2481a7798eed925681b6 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* UnifiedDiffEditor: Fix '+' on added linesJarek Kobus2022-10-111-1/+1
| | | | | | | Amends 15fd4a075461a21cb28410f036aefc48b87316d3 Change-Id: If74b5437be241303de1e157b7980ef10ef6c060c Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-071-1/+1
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I88edd91395849574436299b8badda21bb93bea39 Reviewed-by: hjk <hjk@qt.io>
* DiffEditor: Limit the usage of qMakePairJarek Kobus2022-09-301-5/+5
| | | | | Change-Id: I0f7f4235cba4e1f6df4245cb51a37ff82a8e5109 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* UnifiedDiffEditor: Early return inside jumpToOriginalFile()Jarek Kobus2022-09-301-20/+18
| | | | | Change-Id: Ib397c316296db494b81a08214049884c45a3f5e5 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* UnifiedDiffEditor: Move some methods into UnifiedDiffDataJarek Kobus2022-09-291-25/+24
| | | | | | | Like it's done in case of SideDiffData. Change-Id: I27af423e50277c81e596006c960daecc6a51145f Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* DiffUtils: Introduce DiffChunkInfoJarek Kobus2022-09-291-27/+5
| | | | | | | Avoid code repetition. Change-Id: Iea9acef8f8b27793528fa7eaf7044e12dcd21d10 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* DiffEditorPlugin: Introduce DiffFileInfoArrayJarek Kobus2022-09-291-7/+1
| | | | | Change-Id: I884d72e6c500e41969f379d969bcf1f46be8fd5c Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* PatchTool: Introduce PatchAction enumJarek Kobus2022-09-291-2/+2
| | | | | | | | | | 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>
* SideBySideDiffEditor: Avoid code repetitionJarek Kobus2022-09-291-5/+3
| | | | | Change-Id: Ie49834a4896dbf32a87329345e52dc99ca2f86bd Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* DiffEditor: Cleanup includesJarek Kobus2022-09-291-3/+2
| | | | | Change-Id: Id8127b9b0c99ee2a0d5d367cb551a1d5779c5d38 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* DiffEditor: Fix scrolling to current file after reloadingJarek Kobus2022-09-291-0/+3
| | | | | | | This feature got broken during recent refactorings. Change-Id: I9d2d24e7ed63d5512b64c53e4bb9303497871d5e Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* UnifiedDiffData: Remove unused charNumber argumentJarek Kobus2022-09-281-10/+1
| | | | | | Change-Id: I40331b4471a1aa716003943ecfb92a9ee7a4e406 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* UnifiedDiffData: Rename setDiff into diffOutput and make it staticJarek Kobus2022-09-281-14/+13
| | | | | | | | Conform to sibling struct SideDiffData. Change-Id: I7630ec7480c34a94f17ef09904e332da768f0c37 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* SideBySideDiffEditor: Move showing diff into separate threadJarek Kobus2022-09-281-5/+5
| | | | | Change-Id: I8b0a4835cf6f51e4acfd483dcfc7b94585c64bf5 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* UnifiedDiffEditor: Avoid code repetitionJarek Kobus2022-09-281-114/+75
| | | | | | Change-Id: I2e361b29c3d35fe5128b6b5a4a90b6c4ee0de432 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* DiffEditor: Use DiffSide in DiffEditorInputJarek Kobus2022-09-281-4/+4
| | | | | | Change-Id: I195c37f29884f1d066acbb54c8ace07f8801f829 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* UnifiedDiffEditor: Move setting folding markers into threadJarek Kobus2022-09-281-5/+5
| | | | | | Change-Id: I4fc6f08039813c08e70a6798f65abcea219558be Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* DiffEditor: Simplify DiffSelectionJarek Kobus2022-09-281-9/+9
| | | | | | Change-Id: I9de3774fafa9f257974a4231a83b64f375291d87 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* DiffEditorPlugin: Add SideBySideDiffOutputJarek Kobus2022-09-281-15/+2
| | | | | | | | Move generation of SideDiffData into static diffOutput() method. Change-Id: Ie38b3e09dd8222e0219fdfb345bc7cf4a39f6e21 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* DiffEditorPlugin: Various cleanupsJarek Kobus2022-09-281-13/+7
| | | | | Change-Id: Ic0c9c397067b899932bc39d938e63df36fa4caeb Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* UnifiedDiffEditor: Move polishing selections into working threadJarek Kobus2022-09-281-2/+2
| | | | | | | | | | In case of big commit (like 05c35356abc31549c5db6eba31fb608c0365c2a0) polishing selections took about 200 ms. Move this work into thread to avoid extra 200 ms freeze of GUI thread. Change-Id: If159e3f0869264f467c4c015f944a3054609f812 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* DiffEditor: Use DiffSide enum inside FileDataJarek Kobus2022-09-281-7/+7
| | | | | Change-Id: I4c18c52a9737cc46c3faeadf0abd5c4771463e0e Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* DiffEditor: Use DiffSide enum inside RowDataJarek Kobus2022-09-281-7/+7
| | | | | Change-Id: I5511e443e2f76a1dab5cc78eec5faec04ee31bcc Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* DiffEditor: Use DiffSide enum inside ChunkDataJarek Kobus2022-09-281-8/+8
| | | | | Change-Id: Ic10fe9faa6b6ccefcbf4c062663dedefa6bf5872 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* DiffEditor: Introduce DiffSide enumJarek Kobus2022-09-281-49/+39
| | | | | | | This should simplify various diff structs. Change-Id: Ia8c77de558a92a2a64fc13c674a46192521970f0 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* UnifiedDiffEditor: Move showing diff into separate threadJarek Kobus2022-09-281-21/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. 05c35356abc31549c5db6eba31fb608c0365c2a0 (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>
* UnifiedDiffEditor: Refactor internal dataJarek Kobus2022-09-221-78/+64
| | | | | | | | This is a preparation step before making diff showing more interactive. Change-Id: I149b76466c3ccce05d823bac91fe89ac806b9130 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Use SPDX license identifiersLucie Gérard2022-08-261-24/+2
| | | | | | | | | 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>
* DiffEditorWidgetController: Use Utils::GuardJarek Kobus2022-07-251-25/+15
| | | | | | Change-Id: I3d3e22ce26c85859eb8024f2b87c7c85c5ac65f1 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* DiffEditor: Remove workingDir parameter from setDiff()hjk2021-08-171-9/+3
| | | | | | | It was not used. Change-Id: I33a77f4d8238218b90171a98aa25af5b31b17eb3 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Use qAsConst with non-const Qt containers in range-loopsAlessandro Portale2021-02-171-1/+1
| | | | | | | ... in various places Change-Id: Ic6c0c1b9437a1ed402105c7a14a1f5f9454a68d4 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Qt6: Adapt to removed QMap functionalityhjk2020-08-131-1/+1
| | | | | | | | | | | | | | QMap::iterator::operator+() was removed in 14090760a8, necessitating extra code using std::next/prev to workaround. QMap::unite is gone, the replacement QMap::insert was only introduced in 5.15. QMap key values need to have an operator==() available. Task-number: QTCREATORBUG-24098 Change-Id: Ic4cf429ab18cad58b1218180de40eb65586afd77 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Remove unnecessary removeContextObject callsEike Ziller2020-05-271-9/+4
| | | | | | | They are removed on deletion now. Change-Id: I08461ea4938e24ab450df013a0f8f820032381da Reviewed-by: hjk <hjk@qt.io>
* Use isEmpty() instead of count() or size()Alessandro Portale2020-01-201-2/+2
| | | | | Change-Id: I0a89d2808c6d041da0dc41ea5aea58e6e8759bb4 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Git/DiffEditor: Fix staging added/removed lines separatelyJarek Kobus2019-12-021-11/+6
| | | | | | | | 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>