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
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
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
Jarek Kobus
e806ea40cc Pass this context object to the connect()
Otherwise when "this" instance
gets deleted and the sender still exists, the lambda
expression is still invoked for the deleted object.

Task-number: QTCREATORBUG-20223
Change-Id: Ifd5c9e6ce1fe7fde71698c6683cdfcd7566e8d35
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-04-09 09:31:40 +00:00
Jarek Kobus
64233a4fae Fix repeting Stage/Unstage actions in unified diff editor
Don't store diff file index, chunk index and diff editor
controller anymore. Pass needed indices by value,
retrieve them when needed as lambda copy.

Change-Id: I3a81f1ab6d131c0b1d9899ac4b061b6e25582f51
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-02-16 06:48:27 +00:00
Jarek Kobus
11a6f000be Fix horizontal scrolling in sidebyside diff editor
Fix horizontal scrolling in sidebyside diff editor
when doing text search.

Change-Id: I6b52ee50544ef6005b8b79b87b9289dbc7f99dbf
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-02-16 06:48:05 +00:00
Jarek Kobus
990da15c1e Refactor HighlightScrollBar
Rename it into HighlightScrollBarController.
Don't derive it anymore from QScrollBar.
Make it based on QObject and decorate
the existing instance of QAbstractScrollArea as needed.

Fix the highlight of the shared scrollbar of the SideBySideDiffEditor.
Both left and right diff editors have their own
HighlightScrollBarController and their own separate overlays, but both
overlays are created as children of the same right editor instance.

Synchronize also the cursor between left and right editors.
Make highlight current line working.

Make the overlay transparent for mouse events - this fixes
issues on macOS when scolling over invisible scrollbar.

Change-Id: Iab05c360173e09d8748658c59785da86438a7189
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-12-12 08:17:58 +00:00
Andre Hartmann
5003f644ac SideDiffEditorWidget: Fix Clang semantic warnings
Change-Id: I0f92993aa6152836237f7429c66761c22692075d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-12-09 14:45:49 +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
Ulf Hermann
389ca50865 DiffEditor: Add missing override
Change-Id: Ic0541a8c902ae10c622cf8843990bdc4e21b9fe8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-11-07 11:47:00 +00:00
Jarek Kobus
96aeabd0a6 Add folding to Side-by-side diff editor
Add folding for files and chunks.

Change-Id: I76476351e88f0b3e71e3cccbca0fa17b02c26226
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-11-01 09:13:17 +00:00
David Schulz
3bea291427 DiffEditor: Remove indirect call to firstVisibleBlock
Change-Id: I37db7e280ea9f327ff8ab33b0f9b1fee813fcba9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-25 06:21:32 +00:00
David Schulz
56260add50 DiffEditor: remove unused member of SideBySideDiffEditorWidget
Change-Id: Ic46fe95bc493c9242b0896737fb324f3816cc0d4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-25 06:21:25 +00:00
Orgad Shaneh
6334632f00 DiffEditor: Jump to original file on Enter
Task-number: QTCREATORBUG-18650
Change-Id: Id6bfb9892aee2e4d7b7772b7dd208107ec4b3b11
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-07-31 08:43:05 +00:00
Jarek Kobus
13fc3c8313 DiffEditor: Share "failed" state among multiple views
Change-Id: Id049ce8eafcb21d5e60fae17c47df8657c0e5779
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-07-05 14:20:46 +00:00
Jarek Kobus
228e4a7542 DiffEditor: refactor loops and const correctness
Change-Id: I21af8db55ff5a012de04b4934de1940babf75058
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-06-28 08:51:36 +00:00
Orgad Shaneh
9154a457fd DiffEditor: Add context info to side by side editor
Task-number: QTCREATORBUG-18289
Change-Id: Ibc4a626c22cc1d96b27e8744a87dd2780cec549e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2017-06-02 09:52:29 +00:00
Eike Ziller
ee722a047c DiffEditor: Fix editor actions
The text editor widgets all need a TextEditorActionHandler that takes
care of the editor actions for them.
Each text editor needs its own context, so the editor with focus
receives the actions. This does not happen automatically for these text
editors, since the diff editor manages these itself.

Task-number: QTCREATORBUG-9445
Change-Id: Ib42f095ec23550e401e8ee9b36f3f49517a22877
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-05-18 08:24:26 +00:00
Montel Laurent
158ab3316e Use QString::*Ref method
Change-Id: I63a10f274dd17e08b5b8a2577762cc9f7960b5af
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-04-21 12:04:38 +00:00
Orgad Shaneh
3ec5a18990 DiffEditor: De-slot
Change-Id: I132da3f0475ced470ffd7c4cace60825b9dec44f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2017-03-20 08:05:06 +00:00
Jarek Kobus
b29513aa5b Display "Waiting for data" properly
Display "Waiting for data" instead of "No differences" when creating new
instance of an editor for the same document (e.g. by splitting the view)
during document reload.

Change-Id: If254006de3914ad4416c7405874e8cbea57ddd8d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-01-09 10:49:13 +00:00
Jarek Kobus
3c1647e6b2 Refactor DiffEditorWidgets, introduce common widget controller
Reduce code repetition.

Change-Id: I416555dd83ce888088a6a259777c294a6feb35f4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-07-25 13:28:45 +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
Eike Ziller
ce96a8b80a CodePaster: Register type safe service object
Use Q_DECLARE_INTERFACE et al.
This provides a way to have the dependency on code pasting
optional in the using plugins (VCS, diff editor), while
still being able to use a nice API to perform the pasting itself.

Change-Id: Ia61e0066d552e45031f4aa7fd1f6693b68f92384
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-07-08 07:41:43 +00:00
Eike Ziller
e00aa54f4e Add override keyword to IEditor & TextEditorWidget implementations
Change-Id: I403101d788d9edfea5c5c9440ab4f39ad00e81f7
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2015-06-09 04:17:42 +00:00
Tobias Hunger
5c60bb9dd5 DiffEditor: When jumping to a file then put that block to the top
When jumping to a file via the dropdown box: Have that block be
scrolled to the top of the view, not to the center. This is way
less confusing.

Change-Id: I5c629dda1af8bff76ca93a70357aa35c8efcb37a
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-04-17 08:24:31 +00:00
Tobias Hunger
25c663da44 DiffEditor: Remove dead code
Change-Id: I7d29bfc944e32ad03f237946b4bea08d1a9502c5
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2015-03-11 10:04:28 +00:00
Tobias Hunger
3d360653cf Clean headers of the DiffEditor plugin.
Change-Id: I1c49527f010acbece31849127fc4d182678b6f37
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-03-10 14:28:13 +00:00
Tobias Hunger
dbe535b3c7 DiffEditor: WS only change
Change-Id: I845f492c27d2149ed01e175af5f974f86c7bd1d6
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2015-03-10 11:51:37 +00:00
Tobias Hunger
b2b8b867d6 DiffEditor: Refactor the user-facing parts
* Move all data handling into DiffEditorDocument
* Move much of the logic of how to update views into the
  DiffEditor.
* Introduce a base class for the different views on the diff
  to implement.
* Remove DiffEditorGuiController
* Make DiffEditorController smaller and merge the DiffEditorReloader
  into the class
* Simplify communication between the classes involved
* Make much of the implementation private to the plugin

Change-Id: I7ccb9df6061923bcb34cf3090d6d8331895e83c7
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
2015-03-10 10:25:52 +00:00