Commit Graph

63 Commits

Author SHA1 Message Date
Jarek Kobus
1a70403f94 Remove unused includes of QFormLayout
Change-Id: Ia877cb57037342f2a7b332b29d9cb45e9b01c4bc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-11-18 07:33:29 +00:00
David Schulz
af7b0802a8 Python: fix PySide project tool detection
The tool moved to the PySide6-Essentials module.

Change-Id: I204d2025bc51b6c5cffe82cba66878d077f03b72
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-24 09:17:46 +00:00
David Schulz
f012f1b245 Python: try to find interpreter on device for run configuration
If the default interpreter is not on the run device of the kit try to
find any interpreter on that device and use it as the default
interpreter for this run configuration.

Change-Id: I52985281f0f1d2ac88759169400d64121299f95d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-20 12:46:44 +00:00
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +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
hjk
26dd8aef2a Python: Convert to Tr::tr
Change-Id: I0241053b0d51dbb1a60c43351cbff543fd52573d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-21 08:25:04 +00:00
David Schulz
e74999cced Python: check for pyside tools after installation
Change-Id: Icf9ae0ec08a78efc51216daa3304e76f8e812d5f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-20 13:11:07 +00:00
David Schulz
ca47064020 Python: Fix scripts path to global/venv pyside installations
... when checking for pyside tools.

Change-Id: I1aaac9dd9da76f08ada031cc88761dba36c4e3b6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-20 13:10:56 +00:00
David Schulz
a750961f4d Python: make sure working dir is on python device
Task-number: QTCREATORBUG-27536
Change-Id: If9c8f88f2a871ec71b200020689a4ae9df1e8a6a
Reviewed-by: hjk <hjk@qt.io>
2022-06-15 12:11:36 +00:00
David Schulz
ff8495b0a2 Python: fix pyside tool detection
pip might return an incomplete list of files on Windows for
installations. So we need to manually check the Scripts
folder for the tools we are looking for.

Change-Id: I40778607fd2f2015059744f17a539ca381b85560
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-03 07:35:13 +00:00
David Schulz
b9034e8426 Python: support python 3 mime type in language client
Change-Id: I9319442aecc61e854aaeb0778b959086a70d431b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-02 13:29:17 +00:00
David Schulz
b9627ddba7 Python: add pyside uic extra compiler
To be able to autocomplete code from .ui forms we need to feed the
python language server the compiled form. The uic extra compiler
generates a temporary ui_name.py file for uncompiled or unsaved ui
files. These files are inside a folder that gets appended to the python
path environment variable for the python language server.

Change-Id: I9f48d2012162f33986639315189c41e0a7e0dad2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-02 09:09:22 +00:00
David Schulz
3ad82a66f9 Python: move pyside detection to runconfig
Change-Id: I781c4d005ced0c884081616696eae7f738f38c6f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-05-31 05:59:45 +00:00
hjk
2837f4d777 ProjectExplorer: Pass macroexpander (again) to WorkingDirectoryAspect
Broke with 8dacb123e0.

Probably calls for a more centralized approach again. Later.

Change-Id: Ibf52487d68d7938d4b5dfb38f1f0a5b0e1a97bc3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-05-30 14:45:47 +00:00
hjk
8dacb123e0 Utils: Pass MacroExpander to ArgumentsAspect constructor
In the past we wanted to keep the aspect constructor simple but
it turned out that exceptions were needed and accumulating, so those
are likely here to stay.

By passing also the MacroExpander to the ArgumentsAspect constructor
allows other single-purpose warts like the ProjectConfiguration::doPostInit()
machinery can be removed.

Change-Id: I148b0ca1ab0740270eecd0d3134620de65a86d4f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-05-20 07:06:10 +00:00
David Schulz
fbefd45b94 Python: add pyside build configuration
Task-number: QTCREATORBUG-27219
Change-Id: I19340c57789933c7104ec5d6fec628ed810c5f3e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-05-03 08:55:11 +00:00
hjk
0da130c4ef Python: Apply 'static' pattern for singleton members
Plus some cosmetics.

Change-Id: Ia2c8f425f0491fbe6a0bbf2e508857a5550e4d38
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-27 08:55:02 +00:00
hjk
28cfdf388a Promote previously python-specific InterpreterAspect
... and drop PythonRunConfiguration, which is a plain RunConfiguration now.

Change-Id: I540cb738180fc1424f730d6d1998886915ce527b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-27 08:54:22 +00:00
hjk
5da8695dca ProjectExplorer: Pass envAspect directly to WorkingDirectory constructor
This trades a now necessary order of setup for the now removed
"acquaintSiblings" facility.

Change-Id: I85058578b792e210f24573e2ab4e3a40a8813a11
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-04-22 11:53:59 +00:00
David Schulz
bf5114dcee Python: work with Interpreter in PythonRunConfiguration
This saves some unneeded file path conversion and lookups in the
python settings.

Change-Id: I8647858320183dc1da027363b4ab265f6c75e1ae
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-28 12:15:37 +00:00
David Schulz
7cb3a726d4 Python: add PySide installation check on document open
Checks if the document imports PySide and whether the selected python
interpreter can find a PySide installation. If not show a global info
bar that can install PySide via pip like the python lsp server.

Task-number: PYSIDE-1742
Change-Id: I02c0d5f6eb268f3d8826d4fb9d9ec3c7c48b8638
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-28 12:15:15 +00:00
David Schulz
49ac087955 Python: move language client functionality out of utils
There will be more lsp specific functionality so moving it into its own
space is reasonable.

Change-Id: Ic87d437182d68673b53f662c804707138fef5b6c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-01-18 08:14:57 +00:00
Eike Ziller
195abefe7d EditorManager: Remove QString openEditor(At) overloads
In favor of the FilePath/Link ones.

Change-Id: I5caf9e0f8de304ff4ee12329557aa50a6f3a0c69
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-02 08:11:14 +00:00
hjk
8e40db5580 Python: Fix setting current interpreter
There was a vicious cycle started when loading a runconfig pointing
to an interpreter with an id that was not present in the combobox.

Amends 9decfcb151.

Change-Id: I77595795eb825bde55919c8d8dd632f3bf397578
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-23 05:59:59 +00:00
David Schulz
9decfcb151 Python: fix opening repl for project files
The python interpreter aspect relyed on having a combo box setup when
looking up the current interpreter. This combo box is just initialized
when the widget is shown since recently. Using the current id that is
valid all the time instead to get the correct interpreter.

Change-Id: I0a6bde46864c44c9408d0d7331164b49da65c7df
Reviewed-by: hjk <hjk@qt.io>
2021-06-10 08:59:05 +00:00
hjk
d5dec08893 Utils: Pass settings key to BaseAspect::saveToMap
Makes the code on the user side somewhat more symmetric and is a
bit more flexible, even if that's not used right now.

Change-Id: I29a5182463ead0e4a39fcb51ecf4fdd5adf2a203
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-12 11:30:22 +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
Orgad Shaneh
3122a1bfc5 Aspects: Remove some more default values
Change-Id: Iadee8b8f1eeb3ff009a667d45a51f6f5a94329ca
Reviewed-by: hjk <hjk@qt.io>
2020-11-10 08:06:51 +00:00
hjk
2cabd2ceb5 Utils: Consolidate LayoutBuilder interface a bit
- the var args template for addItems was overkill creating a lot of
  instantiations. Use a temporary list instead.
- allow default constructed LayoutItems to be used for an empty cell,
  avoiding the use of a QLabel with empty text
- add an addRow({...}) overload as convenience shortcut for
  .startNewRow().addItems({...}
- rename startNewRow() to finishRow()

Change-Id: I6d49dacbac3d7acf140ca526884ba1ceeeca2e0d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-09-24 10:32:26 +00:00
hjk
cec468d78a Utils/ProjectExplorer: Move re-usabled bits of aspects to Utils
Classes involved are BaseAspect and some derived classes,
LayoutBuilder and VariableChooser.

This is mostly mechanical, with various include/using changes
to make it compile.

Change-Id: I624a457f3555f102e541c4c71e33a9423af32250
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-09-23 07:44:42 +00:00
Eike Ziller
5ad724c61b Merge remote-tracking branch 'origin/4.13' into master
Conflicts:
	src/plugins/qmakeprojectmanager/qmakeproject.cpp

Change-Id: Ieb1c3e946f11d3c4fa1ee6b5afdf83cc532d8aed
2020-09-17 10:28:19 +02:00
David Schulz
364288b79c Python: Fix loading working directory
Fixes: QTCREATORBUG-24440
Change-Id: I27a543f764e285acf678427cc909d2a95e5cb322
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-09-17 07:52:58 +00:00
hjk
51e7bce109 ProjectExplorer: Rename Base*Aspect to *Aspect
In most cases they are used directly, so there's not much Base* in that.

Added the old name as alias as porting help for a while.

Change-Id: I494a8a560b8996bcf74915ea3570b504df6a6b4c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-08-14 07:35:43 +00:00
hjk
e1c88116b3 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
(cherry picked from commit 430a33dcd9)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-07-06 11:15:18 +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
03838decb9 More QRegularExpression and include for Qt 6
Task-number: QTCREATORBUG-24098
Change-Id: Ia537e26efd3f37319c38d906e569b255768371f9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-06-25 07:13:43 +00:00
Christian Kandeler
b02f6b5d30 ProjectExplorer: Give the Task class an explicit summary
We'd like to create more useful tasks from compiler output, that is, try
harder to identify consecutive lines that refer to the same issue and
create one task for them, rather than one for each line. In such
"aggregate" tasks, the first line will not necessarily carry the main
information. Therefore, we make it explicit what this main information
is by introducing a dedicated summary member.
Also streamline the font handling for compile tasks.

Change-Id: I933f2643a13c710dab1ab548c56669b129026eb5
Reviewed-by: hjk <hjk@qt.io>
2020-05-14 08:23:59 +00:00
Christian Kandeler
d3be54bcd1 QtSupport: Add QtTestParser to the list of output formatters
... when creating a run control for a Qt project. Now tasks will appear
in the issues pane for QtTest application output in the app output pane.

Task-number: QTCREATORBUG-22665
Change-Id: I2674f3d4f9aabc0a4db4178dcd5495b822f14022
Reviewed-by: hjk <hjk@qt.io>
2020-04-28 08:45:49 +00:00
Christian Kandeler
1c6e4fbd32 Merge output formatters and output parsers
Now only one piece of code needs to be written to both linkify output in
an output pane and create tasks for it in the issues pane.
The calling sites are also simplified. For instance, until now, build
steps had to feed their output parsers manually and then push the
created tasks up the signal stack in parallel with the actual output,
which the build manager relied upon for cross-linking the output pane
content. Afterwards, the output would get forwarded to the formatter
(and parsed for ANSI escape codes a second time). In contrast, a build
step now just forwards the process output, and task parsing as well as
output formatting is done centrally further up the stack.
Concrete user-visible improvements so far:
    - File paths in compiler/linker messages are clickable links now.
    - QtTest applications now create clickable links also when run
      as part of a build step, not just in the app output pane.

Task-number: QTCREATORBUG-22665
Change-Id: Ic9fb95b2d97f2520ab3ec653315e9219466ec08d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-04-23 08:47:08 +00:00
Christian Kandeler
b7de4eb263 OutputFormatter factories: Handle the "no target" case
Amends d42920d372.

Change-Id: I302c4e54cbe2dcc2340deffa99237e909418939d
Reviewed-by: hjk <hjk@qt.io>
2020-04-22 13:25:34 +00:00
Christian Kandeler
c0c2df203d Utils: Split up OutputFormatter class
An OutputFormatter takes some string and prints it into a text edit.
In addition, it can ask any number of registered OutputLineParsers
whether they think any special formatting should be applied to the
current line.
This mechanism is now properly modeled by our class design, rather than
being hidden in a monolithic class where everything had the same type,
no matter what its purpose was.
Prospective contributors can now simply be pointed to the
OutputLineParser class and will see at one glance what they have to do.

Change-Id: I9844499f062c94fb038ce73fd6f26576910148c2
Reviewed-by: hjk <hjk@qt.io>
2020-04-14 14:15:26 +00:00
Christian Kandeler
0f16378188 OutputFormatter: Do all formatting centrally
Instead of working directly on the text edit, the specialized
OutputFormatter classes now simply ask the base class to do it for them.
In practice, the request currently always is "turn this part of the text
into a link", but the interface can be extended to other types of
formatting, should that ever be required.
This is a win/win situation: Derived classes no longer have to fiddle
with QTextCursor & friends (nor do they have to call any base class
functions), while the base class can make strong assumptions about what
the derived class does to the text edit (i.e.: nothing).

Change-Id: Icc4bc52d4001b0359247563e39a206fa274833d7
Reviewed-by: hjk <hjk@qt.io>
2020-04-14 09:46:34 +00:00
Christian Kandeler
04a99c1de1 Remove the limitation that output formatters have to be exclusive
Introduce an aggregating output formatter that forwards its input to a
sub-formatter that feels responsible for it, or otherwise lets the base
class handle it.
Our output panes now use such an aggregating formatter.
In particular, this means that in the future, we won't have to stuff all
run control output formatting into the Qt output formatter anymore.

Change-Id: I5498f200a61db10ccff3ec8974c6825da7f7072d
Reviewed-by: hjk <hjk@qt.io>
2020-03-20 13:48:15 +00:00
Christian Kandeler
ef6af1b7df OutputFormatter: Do the newline handling centrally
All output formatters are line-based, and they all did their own line
splitting and, if they didn't entirely ignore it, handling of partial
lines.
Instead, we now do all the book-keeping in the base class, and the
subclasses always work with complete lines.

Change-Id: I0b0df7951d0e4f6601f4d912230071784c87b3d3
Reviewed-by: hjk <hjk@qt.io>
2020-03-19 09:31:02 +00:00
Christian Kandeler
9348ac5fec Utils: Remove the *SameLine OutputFormat enums
Presumably, they were intended for output that shouldn't get an
automatic newline, but if there ever was such a thing as automatic
newlines, it must have evaporated over time. All users of
OutputFormatter provide a newline if they want one.

Change-Id: Ibd219b7305fd503ce075d6f77930d2b538d5e2e8
Reviewed-by: hjk <hjk@qt.io>
2020-03-18 13:52:17 +00:00
Christian Kandeler
0ff5bf75e1 Move some code from OutputWindow to OutputFormatter
That's where it belongs: The logic there is applicable to all output
formatters, not just those used via an output window.

Change-Id: Idf4ca8d22631ca96feb97553f28724c0275e0bf8
Reviewed-by: hjk <hjk@qt.io>
2020-03-17 09:39:12 +00:00
Miklós Márton
aeb7ef6b37 Remove duplicated code
Merge QtOutputFormatter::linkFormat and
PythonOutputFormatter::linkFormat to OutputFormatter::linkFormat because
these two functions were identical.

Fixes: QTCREATORBUG-23562
Change-Id: I1337b2fd66fc7d7b6742eb5e9c1a2caf1dc6b5bd
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-02-05 08:22:53 +00:00
David Schulz
eebbd1ebc8 Python: Add option to disable buffered output
Fixes: QTCREATORBUG-23539
Change-Id: I1679642f470bd7ec2a478b41e942935a6e7ba027
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-02-03 07:48:02 +00:00
hjk
b1474dc5ef ProjectExplorer: Replace RunConfiguration::doAdditionalSetup
... by an explicit update() call. This is what effectively done in
most cases, and should be harmless and reasonably cheap in most other
cases.

Change-Id: I323112ec7cdbccf19050ac54466d8e1d97a0516e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-12-17 16:29:45 +00:00
hjk
684d3e40a7 Python: use new runconfiguration aspect update mechanism
Change-Id: I60807350460e75172bf4744beeb1474755ff4187
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-11-27 08:07:04 +00:00