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>
This is a preparation step before making diff showing more
interactive.
Change-Id: I149b76466c3ccce05d823bac91fe89ac806b9130
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
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>
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>
Do the same as in case of sidebyside editor.
Task-number: QTCREATORBUG-18306
Change-Id: I1364aed0edb02dd9f5432e191ce4fb4b2db34430
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
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>
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>
* 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>
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>
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>
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>
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>
* 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>
The guicontroller is managed by the diffeditor, which is the only one able
to access these objects, so there is no need to ever return the pointer.
Change-Id: I6388a78bcadae67dae669bf7e96298444983c3e8
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Mostly done using the following ruby script:
Dir.glob('**/*.cpp').each { |file|
next if file =~ %r{src/shared/qbs|/qmljs/}
s = File.read(file)
s.scan(/^using namespace (.*);$/) {
ns = $1
t = s.gsub(/^(.*)\b#{ns}::((?!Const)[A-Z])/) { |m|
before = $1
char = $2
if before =~ /"|\/\/|\\|using|SIGNAL|SLOT|Q_/
m
else
before + char
end
}
if t != s
puts file
File.open(file, 'w').write(t)
end
}
}
Change-Id: I04454108cf2818bb88237849169a8359dd408de9
Reviewed-by: hjk <hjk@theqtcompany.com>
This helps me a lot in understanding where the signals go:-)
Change-Id: Id6ed6fccc4ca6852887b7e140deeea60252fe062
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This mainly merges TipContents into the the actual
tooltip labels.
Change-Id: I64b576c987bce034842f7e3f324b81595dae0713
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Looks like this is not needed anymore, since
now BaseTextEditor has its own automatic
font settings application mechanism implemented.
Change-Id: I61c8dafdb76e9e5d04207d0762d4ede4707531e9
Reviewed-by: hjk <hjk121@nokiamail.com>
Store indices in controller and avoid passing them around.
Change-Id: I49c80cb6cf6734a18f80ad5c7c441973d246708f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com>
There are still a few places where the EditorWidget is the primary
object, or several of them per "visible" IEditor (e.g. Diff).
Provide a means to streamline setup there, too.
Change-Id: I14cfbd68e555ebc539e707032a0e5bef563e0a36
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
In most cases, the *Editor constructor does not need to
access the *EditorWidget.
Change-Id: I1f5c076a0f723d5d82b398e8c250c7bd1d47eb17
Reviewed-by: Christian Stenger <christian.stenger@digia.com>