Commit Graph

215 Commits

Author SHA1 Message Date
hjk
44a42db1ae ProjectExplorer: "Upstream" line number display for FileNodes
So far only used and set with QBS, but conceptually usable more
generally, and harmless if not used.

Change-Id: I1d2d615f5613340690de22a1c7d716a193fb1f05
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-02-26 13:58:18 +00:00
hjk
7bf10a5842 ProjectExplorer: Use setter for VirtualFolder's priority
More uniform code.

Change-Id: I9a10a1bb15b0df9cf30c68d2c0537bfae2bed98a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-02-26 10:42:45 +00:00
hjk
65be7c2915 ProjectExplorer: Use a setter for the Node's type
Change-Id: I3cc496151888cdecff0be54043a24fefe5ee2b02
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-02-26 10:39:58 +00:00
hjk
ffa88006a5 ProjectExplorer: Replace FolderNode ctor display argument
... by use of the setter.

Change-Id: Ie6bf15b4dfae4d4e4d98694313b6e7dc9a22c117
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-02-26 10:33:07 +00:00
hjk
2aacf26a77 ProjectExplorer: Remove Node::m_id
It was only used within cmake, in a role that is nowadays covered by
buildKey.

Change-Id: I4fd77c06a3bb8965db5235315cb017c7b548fbaa
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-02-26 09:37:02 +00:00
hjk
f844f54cb7 ProjectExplorer: Use setters in ProjectExplorer::Node
Instead of constructor arguments. This makes it clearer on the
user side which value is actually changed.

Change-Id: I63ae8cd139a49700996c8874098111aad89ace22
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-02-26 08:26:43 +00:00
hjk
09372918c1 ProjectExplorer: Remove FileNode's isGenerated constructor bool
Use setter of base class, similar to setListInProject() before.

Change-Id: Id620f0084a5dec0410f29c80f8f6393a6bcd5050
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-25 12:23:31 +00:00
Christian Kandeler
11f989bb93 ProjectExplorer: Allow to add existing project as sub-project
Implemented only for qmake as of now.

Fixes: QTCREATORBUG-5837
Change-Id: I78f6ce55d6a149a75ae595f7a86d39dc55496819
Reviewed-by: hjk <hjk@qt.io>
2019-02-20 16:15:13 +00:00
hjk
5d1114fe52 ProjectExplorer: Drop the target argument
... from ProjectNode::targetData and setTargetData, and rename them
to data and setData.

It was only used in the implementation to retrieve the right node,
instead move the responsibility to find the right node to the caller.

Current assumption is that the functions were always called on
the right node already.

Change-Id: I9ae7e8a7ed5c79b924b99fd9a6a652bad56d114a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-12-20 16:18:37 +00:00
hjk
93257a56a0 QmakeAndroid: Replace remaining AndroidQtSupport
This uses the same approach as in the previous patches: Have some
generic interface in the base classes (here ProjectNode::targetData()
setTargetData()) and implement on the qmake project side.

Implementation for Cmake/QBS is architecture-wise possible, but
not used right now, and left for later.

Change-Id: I3bbf66170020cf9027a894cd66db15ec7ffbf499
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-12-20 13:13:51 +00:00
hjk
f2bade30cf ProjectExplorer: Introduce a FolderNode::findProjectNode()
And use it.

Change-Id: Iaf13c4661e397bdb4d756c352683b696e337c8af
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-12-18 14:59:40 +00:00
hjk
ee564b2249 ProjectExplorer: Add a convenience function to walk project nodes
... recursively.

Change-Id: I44a7e29867c26e2586d04fd8d6c16990ce047c6d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-11-28 12:36:40 +00:00
Ivan Donchevskii
1442a1186d ProjectExplorer: Fix typo in findNodes
It makes sense to add all matching child nodes for the folder
instead of the only one which can even be nullptr.

Change-Id: I134a8073cfae557db2cb44c313239f18b97bda97
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-11-01 09:13:21 +00:00
Orgad Shaneh
2f6c6b632c ProjectExplorer: Remove versionControls argument from scanForFiles
Retrieving the list is cheap, there's no reason to store it and pass
it through all these functions.

Change-Id: I394b512c113af92f60cfb8c2f6561d1617d9cd36
Reviewed-by: hjk <hjk@qt.io>
2018-10-02 06:59:56 +00:00
Christian Stenger
ce12c239ff ProjectExplorer: Fix replaceSubtree for project nodes
Ensure to keep node alive as long as needed.

Task-number: QTCREATORBUG-20616
Change-Id: I57a720d3e31e14bcb8388de5fef68f70db370c90
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-06-27 13:09:00 +00:00
Tobias Hunger
2df36926f5 CMake: Use FolderNode::addNestedNodes for unique_ptr in server-mode
Remove FolderNode::addNestedNodes that take raw pointers now that the
last user is gone.

Change-Id: If2ca3864934d9239ac136e65c0b7dbcea7caf220
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-04 09:03:15 +00:00
Tobias Hunger
bdd2dd371e ProjectExplorer: Add FolderNode::addNestedNodes taking unique_ptrs
Use that in CMake's tealeafreader.

Change-Id: Id1c372b083df380d0d930668cf7eec4ee89060c2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-04 09:02:56 +00:00
Tobias Hunger
b57ce2d7a6 ProjectExplorer: Fix crash on replaceSubtree
Do not double-free oldNode.

Change-Id: Icce2d13b6afd24f2e37c5ca7e2b572a6784e69e1
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-05-03 09:02:48 +00:00
Tobias Hunger
6fbf0255eb ProjectExplorer: Remove FolderNode::addNode taking a raw pointer
Change-Id: I53b765d2c3e71889386c76425662bfcc47bdf582
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-02 14:55:29 +00:00
Tobias Hunger
8bbe795c39 ProjectExplorer: Make FolderNode::replaceSubtree take a unique_ptr
Change-Id: I8e853c00ec24838bdca342e3f1a1b1213f32ef93
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-02 14:55:21 +00:00
Tobias Hunger
d332954567 ProjectExplorer: Add and use addNestedNode(...) that takes unique_ptr
Change-Id: Ieb26721d053111fb350494e31d1f6da3fe642420
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-02 14:55:15 +00:00
Tobias Hunger
147e6078ad ProjectExplorer: Make FolderNodeFactory return an unique_ptr
Change-Id: I9b611c4a3ff0928b2078dc30a44eb39df67c8d89
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-02 11:34:47 +00:00
Tobias Hunger
04057106ba ProjectExplorer: Remove FolderNode::removeNode
Use takeNode instead.

Change-Id: I7e05c4ba7c18aaabcdad5160f91a2c2ad754b758
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-02 11:34:40 +00:00
Tobias Hunger
1f55ba9012 ProjectExplorer: Use unique_ptr to hold ProjectNodes
Change-Id: Iaa5bea221686564de24138a99b5fe0d09521c118
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-02 11:34:29 +00:00
Tobias Hunger
ad8a6cc0e6 ProjectExplorer: Do not use QFlags
Using QFlags here increases the size of a Node by extending the
m_flags from 16bit to 32bit and adds needless padding.

Change-Id: I9169585a7f91da5b85433fcd6f4d1bb7d39e65c1
Reviewed-by: hjk <hjk@qt.io>
2018-04-26 12:42:38 +00:00
hjk
e20d620043 ProjectExplorer: Let RunConfiguration declare what nodes it belongs to
This feature in question is the availability of the "Run" button in the
context menu of certain project nodes in the project tree to run
something presumably related to/build from that (sub)project.

Previously, the decision was made for certain qmake based projects
(those targeting Desktop, iOS and VxWorks) by some indirection
through the corresponding RunConfigurationFactories.

The patch lets the RunConfigurations decide themselves directly
and removes the indirection, potentially opening the feature for
other qmake based RCs, as well as other combinations (e.g.
PythonRunConfiguration could be associated with its .py file,
without the need to have a dummy project)

Change-Id: Ic489bd1dfa25fcd9102ffa4fa30125565dd2e40e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-03-16 09:55:03 +00:00
Tobias Hunger
f044e69f67 ProjectExplorer: Remove obsolete functionality
Change-Id: Iea9b50c0bf9d855fb039a30062e26f8d6f3bc321
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-03-15 14:04:16 +00:00
Tobias Hunger
034f0209b0 ProjectTree: Fix crash working with resources
Fix the notification of subtree changes to keep the project in
the loop, so that it can adjust its list of known files.

Ignoring that will cause crashes, e.g. when the ResourceEditor
updates its subtree of the project.

Task-number: QTCREATORBUG-19613
Change-Id: Ib7bb9afe48eb248cdf675ba2093b266fd728d7b2
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-01-22 11:51:47 +00:00
Ulf Hermann
e902980dde Treat .ui.qml mime type the same as .qml
Right now, the qmake project manager offers a "Build" context menu entry
for .ui.qml files and various other things are off because the mime
types are different.

Change-Id: Icc966e56513b9c5aed05f929dc8cb728ed408723
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2017-10-18 08:11:42 +00:00
Tobias Hunger
95bd5b0d68 ProjectTree: Fix soft assert
Fix soft assert when accessing the lone project file node in a project
that failed to parse.

Change-Id: I73d9b0012292dd5516a0a9c81cdc4003eebf2a92
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-17 08:17:02 +00:00
Eike Ziller
ddd9e96afa Merge remote-tracking branch 'origin/4.4'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/libs/utils/utils-lib.pri
	src/plugins/clangcodemodel/clangbackendipcintegration.h
	src/shared/qbs

Change-Id: I240e89afc76d8f40ce69d66683014b603f714707
2017-08-23 12:12:41 +02:00
Robert Loehning
b9167a192f ProjectExplorer: Don't hide empty resource files like empty directories
Task-number: QTCREATORBUG-18748
Change-Id: I4de59743c42b99ce0b402f814b4cd0ba5d299338
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-08-18 12:28:45 +00:00
Eike Ziller
d8fd5292f1 Merge remote-tracking branch 'origin/4.4'
Conflicts:
	src/tools/clangbackend/ipcsource/clangiasyncjob.cpp
	src/tools/clangbackend/ipcsource/clangjobrequest.cpp
	src/tools/clangbackend/ipcsource/clangjobrequest.h

Change-Id: Ib8602530663813ade418f995dfd2a736908cfe75
2017-08-15 10:07:51 +02:00
Tobias Hunger
68768d8e61 CMake: Get rid of <Source Directory> in server-mode
Change-Id: Ifa4f813d577ab64351d25eb4be1dc7981687da23
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-04 13:33:56 +00:00
Tobias Hunger
45046f7071 ProjectNodes: Do not derive Project Nodes from QObject
That should save some memory per node, and since creator has a lot of nodes
(e.g. opening the LLVM project adds about 1 000 000 nodes) this should be
noticeable:-)

Calling update inside ProjectTree::currentNode() and rename it to
findCurrentNode() to make sure it is an still existing pointer.
Also, try to reduce the somehow more expensive currentNode() calls
and sprinkle some const around that usage.

Change-Id: I6a7c5db01a71d53d39544d3013cad557d5b96cdc
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-08-01 11:24:53 +00:00
Tobias Hunger
7afae6b4fd ProjectNodes: Allow to specify a list of extra locations for FolderNodes
This is useful for buildsystems to provide quick access to interesting locations,
e.g. related to the targets they define.

Change-Id: Ia23534ccaf15ae63b38354c563907c594ad6879c
Reviewed-by: Jochen Becher <jochen_becher@gmx.de>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-21 12:49:07 +00:00
Tobias Hunger
bc22de5f0a ProjectExplorer: Do not use version manager cache in threads
Do not use VcsManager's cache of version control systems from different
threads.

Iterate over all IVersionControls instead of getting the specific version
control for a directory. This is less exact, but will probably not hurt users.

Task-number: QTCREATORBUG-18258
Change-Id: Iae2be5735a0d7ecc8d774904f6681963fca1d114
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-06-20 14:24:02 +00:00
Orgad Shaneh
7a3eb71cf7 ProjectExplorer: Minor cleanup
Change-Id: I9388053eafae661bb16c75917ca8cc738df8b3c1
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-05-22 10:29:14 +00:00
Tobias Hunger
6dc6eb9ad0 ProjectNodes: Make FolderNode::replaceSubtree safer
Make it safe for an existing note to replace itself.

Change-Id: I8ce04ea45cb851c814b9efbc7d8490c5fb44150e
Reviewed-by: hjk <hjk@qt.io>
2017-05-18 09:19:11 +00:00
Orgad Shaneh
3fe9765073 ProjectExplorer: List sub-project (like pri) files in the locator
Change-Id: Ic501ba0af8bba4589cba62d78f0ef62cd5f5d46f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-05-09 11:43:00 +00:00
Tobias Hunger
d056df2c15 ProjectNodes: Fix crash in FolderNode::addFileFilter()
Task-number: QTCREATORBUG-18160
Change-Id: I1b8fe9f949ca9aa04858321317ebb13eb01236ab
Reviewed-by: hjk <hjk@qt.io>
2017-05-08 12:54:12 +00:00
Christian Stenger
face7b13cd ProjectExplorer: Fix compile for Qt5.6
Change-Id: I259dd516a9b28e34a256321e8ac754f4215205a7
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-05-04 12:26:19 +00:00
Tobias Hunger
0a3409112b ProjectNodes: add listInProject() to Node
Add a setter/getter for listInProject to Node and make the project
list all nodes with this property set in Project::files.

Task-number: QTCREATORBUG-18132
Change-Id: I334e627856d1bc0d033e13c5d629f6657d8d7fee
Reviewed-by: hjk <hjk@qt.io>
2017-05-04 09:16:56 +00:00
Tobias Hunger
4593092649 ProjectNodes: Move isGenerated from FileNode to Node
We have complex nodes like the ResourceTopLevelNode which can be generated.

Change-Id: Ifdbe72323b668961c50252f597a0bf67ec41f30b
Reviewed-by: hjk <hjk@qt.io>
2017-05-04 09:16:42 +00:00
Tobias Hunger
cea68a3fe3 ProjectNodes: Use a set of flags for bools in Node
This has the potential to save some space per node.

Change-Id: I2b8b65c13b355e680965bb7307f9e8d8714dae64
Reviewed-by: hjk <hjk@qt.io>
2017-05-04 09:16:36 +00:00
Tobias Hunger
175643fd7e ProjectNodes: Do not define a copy constructor for FileNode
Nodes are QObjects (still), so they should not have a copy constructor.

Change-Id: I1b20663ee0ec121cda4d39ced7a9f204fb4621a1
Reviewed-by: hjk <hjk@qt.io>
2017-05-04 09:16:27 +00:00
Tobias Hunger
1d160fb7d9 ProjectNodes: Fix forEachGenericNode
Iterate over all nodes in the whole tree, not just the FileNodes
of the children of the current node.

Change-Id: Ib8bf0eaecb2b13bd01dbc61417b83d0873ab6527
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-05-04 09:15:55 +00:00
Orgad Shaneh
b1180280d0 ProjectExplorer: Fix infinite recursion
If some ProjectNode doesn't override supportsAction (like CMake), then the
fallback is FolderNode, which calls the root project node again...

Change-Id: Ie7a469d6aaaae38c8c2ff56e33fed27cf1477b49
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2017-04-07 08:44:34 +00:00
hjk
bd5e2faa75 ProjectNodes: Handle supported actions one-by-one
Getting the full list for a node can get quite expensive e.g. in
cases of recursive calls of QMakeProjectManager::findPriFile.

However, the FlatModel needs to decide quickly on whether an item
is editable to potentially allow renaming.

So split up QList<Actions> supportedActions() into individual
bool supportsAction(action) calls and make sure Rename is not
on the critical path.

Task-number: QTCREATORBUG-17953
Change-Id: I31841847f8aa7d7b94c63d76ce71efb1c930fa69
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-04-05 12:47:03 +00:00
Tobias Hunger
5afc149b69 ProjectExlorer: Match filenames only to find filetypes
Do look at filenames only to decide which filetype a file is.

Change-Id: Ie64ad0a91df1ddd22c1cec4089f2611030560f3e
Reviewed-by: hjk <hjk@qt.io>
2017-03-30 11:36:57 +00:00