Commit Graph

134 Commits

Author SHA1 Message Date
Jarek Kobus
40b0f670e1 DiffEditor: Don't use QFutureInterfaceBase::get()
It's available only since Qt 6.3.

Amends 5ff073df19

Change-Id: I38c8c3b0bc3c94612dee15614f00e83ebc86db04
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-03-10 09:16:32 +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
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
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
c6471341f6 VcsPlugins: Use multi-arg for strings
Change-Id: I8c1c62e3d2f98781ff1468b44ad11640b873695d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-01-11 09:19:53 +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
23f53dcbda MathUtils: Add tangential interpolation
Reuse it in TaskProgress and in ProgressTimer.
Rename MathUtils::interpolate() into interpolateLinear()

Change-Id: Iff4cda1e3b8782cd26277ec75046ca5526be92c0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-11-28 10:07:30 +00:00
Jarek Kobus
6f299f19ac Utils: Move DiffUtils::interpolate into MathUtils
Change-Id: Iac4a21a6c760d8fbf0dce380b1a9a587a9d3468e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-11-28 10:07:18 +00:00
Jarek Kobus
b414268427 DiffEditor: Use AsyncTask
Change-Id: Id5b21b10c7a8805b560eb4fb36fd955b7af34afa
Reviewed-by: hjk <hjk@qt.io>
2022-11-18 16:12:46 +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
3c9303c3b9 SideBySideDiffEditor: Synchronize left and right foldings
Change-Id: I2ff13db98981edf17190870c4d3ecea0113c8f3e
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-10-21 07:37:54 +00:00
Jarek Kobus
d0278ae295 SelectableTextEditorWidget: Handle display settings
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>
2022-10-20 09:19:07 +00:00
David Schulz
33177686fd TextEditor: do not replace nbsp with normal spaces
This fixes saving documents and copy texts that contain non breaking
spaces.

Task-number: QTCREATORBUG-17875
Change-Id: Ie0b0e68cf7d67e768ff99c9acae1937aafc78ce7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-10-04 09:52:35 +00:00
Jarek Kobus
b677fbe992 DiffUtils: Introduce DiffChunkInfo
Avoid code repetition.

Change-Id: Iea9acef8f8b27793528fa7eaf7044e12dcd21d10
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-29 18:46:10 +00:00
Jarek Kobus
aacf25ebb6 SideBySideDiffEditor: Fix context
Suffixed are meant to be different for both editors.

Amends 2d360db2c3.

Change-Id: I4bf8f2b066dbf420eba38a56301d6e24a685caf3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-29 15:53:44 +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
2d360db2c3 SideBySideDiffEditor: Avoid code repetition
Change-Id: Ie49834a4896dbf32a87329345e52dc99ca2f86bd
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-29 15:15:21 +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
67121e6cd3 DiffEditor: Fix scrolling to current file after reloading
This feature got broken during recent refactorings.

Change-Id: I9d2d24e7ed63d5512b64c53e4bb9303497871d5e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-29 11:03:27 +00:00
Jarek Kobus
084c310c44 UnifiedDiffData: Rename setDiff into diffOutput and make it static
Conform to sibling struct SideDiffData.

Change-Id: I7630ec7480c34a94f17ef09904e332da768f0c37
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-28 20:30:30 +00:00
Jarek Kobus
53fc68bc08 SideBySideDiffEditor: Move showing diff into separate thread
Change-Id: I8b0a4835cf6f51e4acfd483dcfc7b94585c64bf5
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-28 20:30:25 +00:00
Jarek Kobus
83be3443de SideBySideDiffEditor: Avoid code repetition
Change-Id: I48d42bd4a6134b24df8bec4239678e7db32ad3e0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-28 18:11:23 +00:00
Jarek Kobus
472d791fec DiffEditor: Use DiffSide in DiffEditorInput
Change-Id: I195c37f29884f1d066acbb54c8ace07f8801f829
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-28 18:11:10 +00:00
Jarek Kobus
f66320c413 DiffEditor: Simplify DiffSelection
Change-Id: I9de3774fafa9f257974a4231a83b64f375291d87
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-28 18:10:32 +00:00
Jarek Kobus
3877ced865 DiffEditorPlugin: Add SideBySideDiffOutput
Move generation of SideDiffData into static diffOutput()
method.

Change-Id: Ie38b3e09dd8222e0219fdfb345bc7cf4a39f6e21
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-28 18:10:26 +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
e67e2121a7 UnifiedDiffEditor: Move polishing selections into working thread
In case of big commit (like 05c35356ab)
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>
2022-09-28 17:13:49 +00:00
Jarek Kobus
2f0ec75284 SideBySideDiffEditor: Refactor internal data
This is a preparation step before making diff showing more
interactive.

Change-Id: I15ab0583af6e4a2655b39b8ae3fb7da10ac245f0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-09-28 15:48:47 +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
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
d96bfdff84 DiffEditorWidgetController: Use Utils::Guard
Change-Id: I3d3e22ce26c85859eb8024f2b87c7c85c5ac65f1
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-25 13:02:43 +00:00
hjk
d842862944 Utils: More porting.h related changes
Change-Id: I528a6950dfa6e09eb7f7ada265c8c41dba816bfd
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-07-14 12:04:25 +00:00
hjk
802de0eb5e Utils: Collapse most of porting,h
Taking the Qt 6 branches, leaving some dummies until downstream
adapted.

Change-Id: Ib9b86568d73c341c8f740ba497c3cbfab830d8a1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-07-13 09:44:09 +00:00
David Schulz
c00330f905 Editor: multi cursor support
Adding a way to create multiple cursors that can insert/remove text at
arbitrary positions in the document. Adding cursors is done by pressing
alt + up/down or by clicking into the editor while holding the alt key.

Fixes: QTCREATORBUG-16013
Change-Id: I495d27d95a3d277220946616ef30efc241da0120
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-27 10:56:54 +00:00
hjk
2f44449a90 DiffEditor: Remove workingDir parameter from setDiff()
It was not used.

Change-Id: I33a77f4d8238218b90171a98aa25af5b31b17eb3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-08-17 11:22:45 +00:00
Alessandro Portale
72d91dc94a Use qAsConst with non-const Qt containers in range-loops
... in various places

Change-Id: Ic6c0c1b9437a1ed402105c7a14a1f5f9454a68d4
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-02-17 14:43:29 +00:00
Eike Ziller
03db57f524 DiffEditor: Fix Qt6 build
QStringRef is gone. QStringView::split is not available until Qt6.
Since using a ref/view might actually have a performance impact in this
case, work around this with a typedef to the available type.

Task-number: QTCREATORBUG-24098
Change-Id: I72dcb4a9c93b73e396dfb9a2760af924db809eaf
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-09-09 06:03:10 +00:00
hjk
89296a98a0 Qt6: Adapt to removed QMap functionality
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>
2020-08-13 12:11:36 +00:00
hjk
430a33dcd9 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-07-06 06:07:13 +00:00
Eike Ziller
e5bb7d1ffe Remove unnecessary removeContextObject calls
They are removed on deletion now.

Change-Id: I08461ea4938e24ab450df013a0f8f820032381da
Reviewed-by: hjk <hjk@qt.io>
2020-05-27 08:42:00 +00:00
Christian Kandeler
3f9e517754 DiffEditor: Fix clang warning about hidden overloads
Change-Id: Iad4cbe1f2e97b862626deeecbcec496fe3457370
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-04-23 13:49:37 +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
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
Friedemann Kleint
ec6b38dea0 Fix Qt 5.13 deprecation warning about QFontMetrics::width()
Replace by QFontMetrics::horizontalAdvance(), fixing:
warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated:
 Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations]

Change-Id: I9991ffefe6e87e872dc35ba291d562e06b28ca64
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-02-15 15:12:02 +00:00
Friedemann Kleint
963dc84cc5 Fix some deprecation warnings in basic plugins
Fix warnings apppearing in 5.13, for example:
warning: ‘QDir& QDir::operator=(const QString&)’ is deprecated: Use QDir::setPath() instead [-Wdeprecated-declarations]
...
warning: ‘static QRgb QColorDialog::getRgba(QRgb, bool*, QWidget*)’ is deprecated: Use getColor() [-Wdeprecated-declarations]
warning: ‘Qt::DropAction QDrag::start(Qt::DropActions)’ is deprecated: Use QDrag::exec() instead [-Wdeprecated-declarations]
warning: ‘void QProcess::finished(int)’ is deprecated: Use QProcess::finished(int, QProcess::ExitStatus) instead [-Wdeprecated-declarations]
...
warning: ‘const QRect QDesktopWidget::availableGeometry(int) const’ is deprecated: Use QGuiApplication::screens() [-Wdeprecated-declarations]
...
warning: ‘const QBrush& QPalette::background() const’ is deprecated: Use QPalette::window() instead [-Wdeprecated-declarations]
...
warning: ‘const QBrush& QPalette::foreground() const’ is deprecated: Use QPalette::windowText() instead [-Wdeprecated-declarations]
...
warning: ‘void QTextOption::setTabStop(qreal)’ is deprecated [-Wdeprecated-declarations]
warning: ‘void QList<T>::swap(int, int) [with T = ProjectExplorer::BuildStep*]’ is deprecated: Use QList<T>::swapItemsAt() [-Wdeprecated-declarations]
warning: ‘void QProcess::setReadChannelMode(QProcess::ProcessChannelMode)’ is deprecated: Use QProcess::setProcessChannelMode() instead [-Wdeprecated-declarations]
...
warning: ‘QString QFileInfo::readLink() const’ is deprecated: Use QFileInfo::symLinkTarget() instead [-Wdeprecated-declarations]

Change-Id: I1d893d42d372245892f2de8406f52dbe7bbd552a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-02-11 09:32:06 +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
Jarek Kobus
b2a1c189e0 DiffEditor: Keep horizontal scrollbar policy in sync
Task-number: QTCREATORBUG-14330
Change-Id: I4c45089f10a9b59cd1bc5b5368f14e0bb0738f22
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-05-16 11:59:47 +00:00