Commit Graph

205 Commits

Author SHA1 Message Date
David Schulz
4526e1908c Editor: remove duplicated path is empty checks when saving
Change-Id: I1fdaacd44918a63e55bce9f15f3f80782ddcbe55
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-08-28 13:01:40 +00:00
hjk
26db9f2c95 Core: De-QObject-ify editor factories
Change-Id: Iaf39ad29576638e994dd2f28d323e445ce2ee93f
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-08-18 07:25:44 +00:00
Eike Ziller
6c601b8cd4 Merge remote-tracking branch 'origin/11.0'
Change-Id: I8d1c9720a868da02b3157a48954eb4e262539c84
2023-06-15 09:48:58 +02:00
David Schulz
95609551a1 Core: add aboutToSave and saved signal to IDocument
We need reliable signals that gets emitted when documents are saved to
inform the language server about the document state change.

Change-Id: I0a1e8a5317ae6984ff17d878952c74f69765e3f9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-06-15 07:19:39 +00:00
Jarek Kobus
a78720060e FindFlags: Move it into Utils lib
It's going to be reused in filesearch.h API.

Change-Id: I7ef133368536a647e19949ba8623134cf078a87d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-05-26 07:59:41 +00:00
Alessandro Portale
e27f82b49e Translations: Merge "OpenWith::Editors" into "QtC::Core"
Change-Id: I241ccc53afa11fa3faa1f1ca9363421827081812
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-02-20 08:00:37 +00:00
Alessandro Portale
d8d24cac7d BinEditor: More Tr::tr
Change-Id: Ide1dfa4d8c1c1746e674856682be66a74522650b
Reviewed-by: hjk <hjk@qt.io>
2023-01-23 09:03:37 +00:00
hjk
118b84ffd6 Use simpler Plugin::initialize() when feasible
Change-Id: I567965d266f20526bda9f823e31a04b354d53fb1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-20 12:13:10 +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
hjk
191815e974 BinEditor: Clean up translation contexts
Change-Id: Ibeb8c93ad1dfa816ccf1160abae8aac6781157d9
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-09-30 07:32:49 +00:00
Eike Ziller
2c51e4bc17 FilePath: Return optional bytearray for file contents
For differentiating between "error" and "empty file".

Change-Id: I2c019ceac625e7be3180afa4d47ae3a24df91c1d
Reviewed-by: hjk <hjk@qt.io>
2022-09-12 11:57:04 +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
Orgad Shaneh
332f35d864 BinEditor: Support character encodings for the text part
Change-Id: I853b5b5c4c4d523033319169e80e6f9063360c17
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-05 11:27:45 +00:00
Eike Ziller
5e9d34793c BinEditor: Fix compiler warning
Unused lambda capture

Change-Id: Ic4d633b794a36d663644c761a0c2d024deee2dd9
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-19 07:51:07 +00:00
hjk
101fda5997 BinEditor: Proliferate FilePath use
Change-Id: I1676ab03257b5acdc1f67e25f419939939707d53
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-27 07:03:26 +00:00
Christian Kandeler
c3d9293004 Fix some compiler warnings
Change-Id: Ibc354e7a8d0342eb12b2b0f9b2c630d15422f22a
Reviewed-by: hjk <hjk@qt.io>
2021-08-18 13:55:24 +00:00
hjk
95c5a12532 BinEditor: Make it work with remote files
For testing, start Creator with  bin/qtcreator docker://<imageid>/bin/ls

Change-Id: I438dde457b6bfb860939ad928fb4e563a3766aa9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-03 07:47:22 +00:00
David Schulz
665c090039 Core: filepathify IDocument
Change-Id: I364a80d070c5f90433309c281c4906ee101a1a1a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-19 09:45:22 +00:00
Eike Ziller
484d40258a IDocument: Simplify permission changes
Take care of handling file permission changes centrally.

TextDocument had its own, caching implementation of tracking the backing
file's read-only state. Move that into IDocument directly.

IDocument::reload with a permission-only change is not a very
interesting case, but every subclass needed to add handling of it.
Instead, remove TypePermission from the file-change types, and handle it
separately via the now unified checkPermissions() implementation.
IDocument::reloadBehavior already was never called with TypePermission.

Change-Id: I321d47ba6193bc878efa9bb50ba7a739fa492745
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-14 14:55:34 +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
hjk
d0960a33ac BinEditor/ClangCodeModel: Remove non-uses of #include <QRegExp>
Task-number: 24098
Change-Id: I58a52ad3c384cc945799ad73e5d3ce392245cd50
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-11 07:48:35 +00:00
Eike Ziller
5b364de168 Use dialogParent() instead of mainWindow()
There are very few reasons to use mainWindow() directly.
Especially for modal dialogs, using dialogParent() is important, since
that guarantees the stacking order in case of other dialogs currently
being open.

Change-Id: I7ad2c23c5034b43195eb35cfe405932a7ea003e6
Reviewed-by: hjk <hjk@qt.io>
2020-06-02 11:44:53 +00:00
Lars Knoll
99a81e78d5 Port from QRegExpValidator to QRegularExpressionValidator
QRegExpValidator is going away in Qt6, so port over to the
version using QRegularExpression.

Change-Id: Iecd1ba1f0e5e01009ae43b79c1ccc73f0fc046b2
Reviewed-by: hjk <hjk@qt.io>
2020-03-20 11:39:42 +00:00
Orgad Shaneh
dd0efea95d Misc: Fix MSVC warnings
C4573: the usage of 'QObject::connect' requires the compiler to capture 'this' but the current default capture mode does not allow it

and implicit conversions from size_t to int

Change-Id: If9b4ba3103cadd5b2a38ba7072d05aa1488a87bb
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: hjk <hjk@qt.io>
2020-02-25 12:19:53 +00:00
hjk
d7ae3b79f8 Core: Make IEditorFactory::createEditor use a function object
Also, replace or remove unneeded Q_OBJECTs, and make base
setters and adders protected.

Change-Id: I212257ef53984d8852dc8c478537199fc9483486
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-05 11:41:29 +00:00
hjk
7e19d1af7c Use even less nullptr for default flags
Change-Id: I5ec30de3e41dfc1c7bf6d5f5e36991eadcbbfb72
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-01-20 10:09:23 +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
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
Alessandro Portale
c7c042498b BinEditor: Modernize
modernize-use-nullptr
modernize-use-override
modernize-use-equals-default
modernize-use-using

Change-Id: I1d1381962b3ffd87cbf761f50d8f073068f9a06f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-11-08 11:45:35 +00:00
Eike Ziller
7d3686359a Fix missing translation contexts
Change-Id: I4402157e7991ad0050333a34394b87ff3d6f4a1b
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-10-25 11:46:57 +00:00
Orgad Shaneh
1486359251 Core: Change IEditor::document() to const
All the implementations are const.

Change-Id: Ib9753fe764dd482d4f4392eec70878d42edc737a
Reviewed-by: hjk <hjk@qt.io>
2018-09-26 06:20:51 +00:00
Eike Ziller
18833bed24 Fix reload behavior of binary editor
It should silenty reload internally triggered changes and permission
changes.

Broke in 4e475fb5e6

Change-Id: I900adac72f51ea5e070c9c4efb59c09296526c42
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-08-22 06:40:36 +00:00
Orgad Shaneh
6019f8f40e BinEditor: Fix "Find Next" for a single char
Change-Id: If35807230969d3620a3a9018af8d2c21236cd58d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-07-16 07:56:05 +00:00
hjk
93a5aa9821 BinEditor: Remove the concept of a current editor
Scales better to multiple views with even less bookkeeping.

Change-Id: Iaa91e614466a59af6f2e567e72e59efe14b7612f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-02-02 14:40:47 +00:00
Alessandro Portale
3624a663d8 Reduce usage of qApp in favor of static function calls
Q*Application classes have unusually many static functions. In many
cases in our code, these functions are unnecessarily called as instance
functions, using the qApp helper.

This patch replaces many occurencies of qApp with the according
Q*Application classname.

Change-Id: I6099a419fa7bf969891269c37ed7a9e817ef5124
Reviewed-by: hjk <hjk@qt.io>
2017-04-24 18:36:28 +00:00
Jarek Kobus
ca4be197ef Revert "Replace virtual isModified method with a getter/setter/notifier"
This doesn't fix the issue with cleaning the clear state of undo stack.
This introduced the issue when ui file is opened it's marked as modified.
It reverts 59c90e00c1
and d0c537ca75

Change-Id: Ifd4ff8483d6c297461632de500a4502b1fd0871f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-21 09:19:56 +00:00
Jarek Kobus
59c90e00c1 Replace virtual isModified method with a getter/setter/notifier
We have lacked the setter and dedicated notifier before.

Change-Id: I58845a48259d260c5cc90ae94b173c79cddcfef9
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-17 14:44:08 +00:00
Eike Ziller
c56aa52b80 Merge remote-tracking branch 'origin/4.1'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/plugins/qmakeprojectmanager/makestep.cpp
	src/shared/qbs

Change-Id: If1787ed23afa786ed2cef57f53c1db642559cbe0
2016-08-31 14:40:38 +02:00
David Schulz
07706a9a8e BinEditor: Do not call openImpl without a file name
Task-number: QTCREATORBUG-16751
Change-Id: I64133932b405707f4d7e1e2213e1ddf73cbcc387
Reviewed-by: hjk <hjk@qt.io>
2016-08-25 12:32:40 +00:00
hjk
6e925910b4 Debugger/BinEditor: Standardize interface
Change-Id: I4acf6bc7648e57c564e86023176ae3905a293a99
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-07-21 06:20:52 +00:00
Orgad Shaneh
6d6f30285a BinEditor: Rename bineditor files to bineditorwidget
Change-Id: Iaa94238cd6a53db1da8dd28c4bc4b6552a7b493f
Reviewed-by: hjk <hjk@theqtcompany.com>
2016-06-27 06:46:47 +00:00
hjk
8fd12818c9 BinEditor: Some modernization
Qt 5 connects, override, style, and a few changes from
int to 64 bit types.

Change-Id: I7ac1879c4f46fcbc5b0ab9f5a6cefdbf2b789774
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-06-03 06:19:20 +00:00
hjk
7dce6bb4f2 BinEditor: Raise size limit to 32 GB
The determining limit is now the Qt api with int values for line numbers
and scrollbar positions, giving us <= 2^31 lines with 16 bytes each.

Change-Id: I266e5bdf358b377c6e27bc2be300a0f6a60e6f68
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-06-01 08:47:51 +00:00
Orgad Shaneh
9057143228 BinEditor: Fix crash on editor initialization
MemoryAgent::doCreateBinEditor calls openEditorWithContents, with empty
contents.

The BinEditor fails to handle this case, and crashes when it divides by
zero.

Task-number: QTCREATORBUG-15835
Change-Id: I8009ef991a445ef4cc192d1bda6a208d51e2b48b
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-03-08 15:22:05 +00:00
Ulf Hermann
5498dfbc89 Add support for contents() to BinEditorDocument
Change-Id: I41c7541984ecc5128c8d742ee44f8b3227c671b6
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-01-22 10:30:02 +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
fc485e6b86 Add default implementation for IDocument::fallbackSaveAs(Path|FileName)
The methods are only relevant for documents without a filePath, and
there was a mix of different irrelevant implementations present in
subclasses.

Change-Id: I4f57d306e5ddd913974cfe6ed0b4db062eb907a1
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-01-19 07:55:56 +00:00
Eike Ziller
cfc89a685e IDocument: Rename defaultPath and suggestedFileName
To fallbackSaveAsPath and fallbackSaveAsFileName. That makes it clearer
what they are for, and that they actually belong to each other.

Change-Id: Ie5b83b9db77d39a7fe9e979cc8f22b7f5b9101a3
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-01-14 14:40:45 +00:00
Eike Ziller
6dd0e79d09 Add override to IDocument hierarchy
Change-Id: I6884f59fe0f06e380254c1f8076dd561d9df4ee3
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2015-06-11 09:32:18 +00:00
Eike Ziller
fef9d7ff94 Editor manager: Abort with a single message if file is not readable.
We show a dialog that offers opening a file in a different editor type
if opening a file fails, but we should not do that if opening the file
fails because it is not readable.
With this change, documents now specify if they failed to open a file
because reading failed, or because they could not handle the file
contents.

Task-number: QTCREATORBUG-14495
Change-Id: I5d4b7cfa74b87ef21b9b55bc30b3ebe2f8238dfa
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
2015-06-10 15:32:55 +00:00