Commit Graph

32 Commits

Author SHA1 Message Date
hjk
d4635d4389 TextEditor: Use new setup pattern for markdown and json editor
And remove the now-empty plugin pimpl.

Change-Id: Ie00b747a4a41bc6efc84ea43db81a71e8364df3d
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-01-29 14:22:22 +00:00
Eike Ziller
acedf93ba3 Remove CommandButton
The same can be achieve with a factory method in `Command`, similar to
the existing ones for actions and buttons which synchronize their tool
tips with the shortcut.

Change-Id: I7e17654706b902dfa14f37b958fc2a60705d5cb5
Reviewed-by: hjk <hjk@qt.io>
2024-01-26 12:25:26 +00:00
Eike Ziller
f22fa5275e Use ActionBuilder for Markdown editor
Also add method that sets the ParameterAction for the context action.
That is an alternative to "binding" the context action, and is useful in this
case, since we do not have a QObject that we can use as a parent for the
constructor that creates the ParameterAction from scratch.

Change-Id: I6ba05208d33460cfa2df9ce8247f7ca30624c22f
Reviewed-by: hjk <hjk@qt.io>
2024-01-26 11:31:57 +00:00
Mathias Hasselmann
0496f20ae2 Markdown: Open external links from text editor
Fixes: QTCREATORBUG-30119
Change-Id: I77ab4b8e030db32b08ed3a8a39562b1943a65dcc
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-15 11:15:32 +00:00
Mathias Hasselmann
8dde6b0a67 Markdown: Follow local anchor links in text editor
Github and others turn `[^footnote]` into anchor links to the next
occurrence of `[^footnote]: Description`.

Task-number: QTCREATORBUG-30119
Change-Id: Ieebcad8ef58ccd8c7faa6aa83a165ce3f7ea1a01
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-15 11:15:16 +00:00
Mathias Hasselmann
444da70fcf Markdown: Open links to local files in text editor
Task-number: QTCREATORBUG-30119
Change-Id: I942ffcec7c84945c4246b31c23d8f7913642f649
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-15 11:13:54 +00:00
Mathias Hasselmann
a63368efdd Markdown: Use regular text editor's toolbar
This allows to have custom toolbar actions while preserving the regular
text editor actions.

Fixes: QTCREATORBUG-30166
Change-Id: I4a22f415d05d80355cfdbe4a2c61501af2292e85
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-11 11:35:19 +00:00
Eike Ziller
cf63b1884e Merge remote-tracking branch 'origin/12.0'
Conflicts:
	src/libs/utils/treemodel.cpp
	src/libs/utils/treemodel.h

Change-Id: I9c5e8ef77905745c201cfc647218c9e747d268d6
2024-01-08 14:56:54 +01:00
Eike Ziller
6831e11c3e Markdown: Add anchors for headings
It looks like GitHub creates heading IDs by

- converting spaces to '-'
- removing anything that is not '-', '_', a number, or a letter
- converting to lower case

Task-number: QTBUG-120518
Change-Id: If09a8e2e0d964e751869eaebd3326a6f983ac495
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-04 12:25:07 +00:00
Eike Ziller
298bd125c0 Markdown: Fix that file links were shown as blank in preview
Handle links ourselves since QTextBrowser doesn't do what we want.

- anchors without file path just jump to anchor
- local files (potentially relative to the markdown file) open in
  Qt Creator (anchors ignored)
- otherwise QDesktopServices is used

Fixes: QTCREATORBUG-30120
Change-Id: I9a68607a0b32255ec075c698a1265cc6d1387e0c
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-04 10:47:38 +00:00
Eike Ziller
583a9dcea1 Add Line/Column indicator to Markdown editor
And make the LineColumnButton independent of IEditor for that (since the
IEditor for the Markdown editor is not a TextEditor.

Change-Id: I52d378ec46d86b1c7928d18f7d39f9726bb6ad23
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-17 08:15:43 +00:00
Leena Miettinen
61088bba69 Fix UI text capitalization, punctuation, and phrasing
Change-Id: I41951660a464601063e5cedd417db2cb7cd37e44
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-20 14:55:38 +00:00
Eike Ziller
c2ba218583 Markdown: Add missing commands for show editor/preview and swap
Change-Id: I4ea63d2bd7a89a1fc8299e83a0050e4f639190c5
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-09 09:31:26 +00:00
Eike Ziller
3ac8185567 Markdown: Add missing actions for text styles
Change-Id: Ie3fcbd49158be4a12e1577ea24d3d6783489877e
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-09-29 10:51:30 +00:00
Tasuku Suzuki
e4ec7f0d14 Markdown: Enable action buttons with unselected text
Add appropriate indicators and adjust cursor position.

Change-Id: Ia4e3027899e0cedd83e94327bbeb0a2c4e518fdc
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-09-29 08:59:03 +00:00
hjk
342e066886 Utils, all: Standardize on QtcSettings
Change-Id: Id222016f15b1c3bfe6710fe5d0297666d4565ef1
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-09-27 13:25:31 +00:00
Tasuku Suzuki
673bcb644c Markdown: Add some tool button to help writing markdown
This allows users to add operator wrapping selected text easily.

Change-Id: If3c21fa41e0dc338a3ec760076406fe046e5adbe
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-09-14 09:27:51 +00:00
Eike Ziller
c35dca17b8 Some more tr fixes
- avoid manual line breaks
- fix plural
- add some translator comments
- explicitly name an output pane
- use imperative for placeholder text
- it is a Markdown editor nowadays, not a viewer

Change-Id: I8418cfe0294c028b7d873305db0af4c25bc1097f
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-06-14 06:10:53 +00:00
Eike Ziller
414e156177 Markdown: Set focus to text editor at start
Take two. Amends d9e3d32a80

Change-Id: Ib3680df9ea7954e00326be2aee71ed2862a74a6e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-06-06 14:09:20 +00:00
Christian Stenger
d9e3d32a80 MarkdownEditor: Ensure focus is inside the editor part
When loading a file it is more likely that the editable view
of the document should be focused than the read only part.

Change-Id: I8b7ed40a233dedf94883072be7462ebeabb78b42
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-06-02 10:42:02 +00:00
Eike Ziller
6865635442 Markdown: Save and restore state
This restores the state of the markdown editor, including text editor
state, preview scroll position and button states, when closing and re-
opening a file.

Change-Id: Ibf1cadd5e0e80149123c6c5f599157e931330343
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-05-10 13:02:25 +00:00
Eike Ziller
349a3a5872 Markdown: Save visible views as default
Remember if editor and/or preview are visible and use it as default for
when a markdown editor is opened.

Change-Id: I19414adfd118003628783fadeae472b7bb7915f5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-05-10 13:02:15 +00:00
Eike Ziller
c68b01c478 Markdown: Support bookmarks and jumping to search results
Redirect the currentLine/Column and gotoLine functions to the text
editor and ensure that it is visible for gotoLine.

Change-Id: I546e2cb1761363e3a75f9adeebcba195e312f00b
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-05-09 11:31:19 +00:00
Eike Ziller
5cb0a56296 Markdown: Delay update of preview
Delay the update: The implementation in Qt is currently very slow, and
while we don't have a fix, editing with immediate update is very
sluggish.

Also do not update the preview, if it isn't visible.

Change-Id: I35e10af232064b02a36a8be3758ea0bbc5b66f40
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-05-08 10:36:19 +00:00
Eike Ziller
302afcdfc7 Markdown: Fix focus handling
When the markdown editor is opened or switched to, the focus is set on
the editor widget. We don't want the focus on the splitter, but on
either the text editor or the preview, depending on what had focus
before.

Change-Id: Ib54899c6251f2c5362f95d990e7150b6fee0f1e1
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-05-05 12:05:42 +00:00
Eike Ziller
ec9680d42e Markdown: Add option for hiding preview
Make it possible to hide the preview, by having a toggle button for
"Show Preview" and "Show Editor", and ensure that at least one is always
on and they are in the order as the views themselves. Disable the "Swap
Views" button if only one is shown.

Change-Id: I0ec1e06c2a8ec94e34bf52eae45ba009fd8cd1b5
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-25 07:26:26 +00:00
David Schulz
8745813721 Editor: add option to switch markdown viewer panes
Task-number: QTCREATORBUG-27883
Change-Id: I18daa688ff7751f984a95132737cfcc219b92108
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-04-21 06:54:24 +00:00
Eike Ziller
71f9e536c5 Markdown: Fix that text editing actions were not available
Add the TextEditorActionHandler and point it to the text editor.

Change-Id: I2c84d6b0160c7402ea32d56ed4dbc72d512072a1
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-20 08:31:06 +00:00
Eike Ziller
a353e9fde1 Markdown: Reuse Markdown highlighter from change log viewer
Change-Id: Ief1b0c135a34bfd5e9b5220e9fbf93f281d8e95a
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-19 11:48:15 +00:00
Eike Ziller
9027758b89 Markdown: Fix keeping scroll position when text is edited
Change-Id: I1812f2835cc0e9bc23aeb1237363b82af1acc479
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-02-23 07:13:17 +00:00
Eike Ziller
c90423eb05 Markdown: Remove unneeded context
Change-Id: I5b574f33d335a1a52792aad4520e5abc16ec2645
Reviewed-by: hjk <hjk@qt.io>
2023-02-23 07:13:06 +00:00
hjk
dce7025969 MarkdownView: Merge into TextEditor
Make it a bit more compact, too.

Change-Id: I448164371c5a1d6969a292feba17caa2826f58c3
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-02-21 07:17:29 +00:00