Drop the list sorting and difference generation which is not
needed in the "build from scratch" setup.
This also removes some of the intermediately introduced
convienience functions and fixes a regression that led to
missing project files.
Change-Id: I39d1966324917f466fb347da3a52552393ca4a01
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
... instead of having to remove/add. Use it in some places
in QmakeProjectManager and the ResourceEditor where the
(sub)tree is rebuild anyway.
Change-Id: I46b3c078c576b72dba6e87432570d030b7572026
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Simplifies the implementation and is the only way used.
Change-Id: Ie3ac1cb66ae7fb85e3d6358a01975ba2e857ab6c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
The FlatModel is essentially a proxy model keeping expansion and
filter state per ProjectTree(View). Using a Utils::TreeModel makes
it fast enough to allow recreation of the proxy structure on
structural changes simplifying the parent/child logic significantly.
The {Session,Project,Folder,File}Node hierarchy still is still primary
information and shared by all views.
Change-Id: Ic08180a19bda37908280ff30e0737d188ed93e92
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This makes sure they need to copy whatever they need.
Change-Id: I767ac0c5f54ca1f9f46acdefe4bd7fea35657312
Reviewed-by: Alexander Drozdov <adrozdoff@gmail.com>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Make priority available on all FolderNodes. Make the sort order
of all kinds of FolderNodes check the priority.
This allows no reorder e.g. ProjectNodes as needed.
Change-Id: I369edd28807ab9f89fb646b0001e1b3eb1a19d7e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
That information is used rarely, and is not too expensive to regenerate,
so there is no need to store and manage it for every node.
Change-Id: I2261853431cd4328ec447031de3b9f5d5347e796
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Override the base node's filePath for recursiveFindOrCreateFolder (and
buildTree, which is based on that). This makes it possible to use this
method to build up trees below project nodes, etc. that have no
representation as a existing directory in the filesystem.
Change-Id: I29fd1ab5b81b144b3db1966dc08dd50470c2d5d7
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Handle root directory properly (a empty filePath in the base node) when
creating folder nodes in the project tree.
Change-Id: Iad761b94ee210406ed5ab9ceb2d00ce25db90046
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Add some methods to look up different kinds of nodes in the
project tree.
Change-Id: Ia91844b45c2a124dc01771297e1f5c414d84e7cb
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Never delete the base folder node when using buildTree to set up
a tree of files in the project tree. This makes sure the node stays
around, even when it turns empty. This matches how buildTree is used
in our code.
Change-Id: Id2a589985d9ac704316db5f210232532dcdb5d58
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Use a class enum with a type quint16 for the NodeType. Frees 2 bytes
per node that can be used for better things now.
Change-Id: Ib84bf8629e9f4a5fb0793355eff0f0d6302167dd
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This is useful for several project types, so do this properly in
ProjectExplorer.
Change-Id: Ic659ff6824daffaeb441e11f5072d496194d48fe
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Add helper code to FolderNode that enables the creation of a tree
of File- and FolderNodes from a FolderNode and a list of FileNodes.
Change-Id: Iba4b6a768fc3d0501851f141372e7e34913ba518
Reviewed-by: hjk <hjk@qt.io>
Allow foldernodes to specify which files they care for when doing
"Add Existing Directory". Before we used a fixed list with C++ header
and source files, which does make no sense for e.g. adding to resources.
Task-number: QTCREATORBUG-15278
Change-Id: I15dad133391485c2bcebd2d864623304b31b5f8f
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
before renaming the file.
This adds a new api:
FolderNode::canRename(oldFileName, newFileName) that asks the
project manager if a specific file renaming could be applied to
the project file.
Change-Id: I77bae56db06d81fd03e590285d6079abea2c514b
Task-number: QTCREATORBUG-14521
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Since a lot of derived classes can make use of those.
Change-Id: I051542e8d318476348d753de4d4c0a30b3a9ed62
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
We should use the actual display name of the node there, not some
hardcoded value.
Task-number: QTCREATORBUG-14240
Change-Id: Idf0fc4cdaab52d7f838d3d48d834a89b55ee593f
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
It appears to take 7% of project loading...
Change-Id: I2d20d919cc861a6ee95af359a584fb27a915cf80
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
The OS X linker makes using dynamic_casts across shared object
boundaries fail, so do all casting in the projectexplorer library
and provide functions to do it.
Task-number: QTCREATORBUG-13864
Change-Id: I0e13c0986f8342d83c3b838ffdd2dd7b8312b13c
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
The only two cases where it is used, the type can easily be passed to
the constructor. So do that.
Change-Id: I1658a377aac56b5332992c445fba39b00620a74b
Reviewed-by: Tobias Hunger <tobias.hunger@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: I1d05d48b23f44e3d589cc2a790803714786b57d2
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
The code that invalidates m_currentNode folder nodes on removing wasn't
run due to a typo.
Change-Id: Ib7d545da4078275b2875c9a4c6246909234c8073
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
The Generic Project Manager builds the tree from the bottom to the
top. Previously no signals were emitted while doing that since
the watchers were added on adding the top level node at the end.
With the new ProjectTree that leads to lots of signals, and leaves
the FlatModel confussed, as that expects the nodes to be already
in the hierarchy and crashes otherwise.
Restore this behavior by checking if the affected nodes are in
the hierarchy.
Change-Id: I832b348867a8abad2afef11297b44f058592cb1d
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
The idea behind NodesWatcher was that it was the central place
to catch node related signals, so that users didn't need to
connect to each individual node and the nodes didn't need to
be QObjects. Somehow Nodes ended up being QObjects anyway.
Both the recently added ProjectTree and the FlatModels consume
the signals the NodesWatcher sends. Unfortunately there's a
ordering dependency between the ProjectTree and the FlatModels.
This patch removes all NodesWatcher and instead makes the
ProjectTree singleton the emitter of various project tree
related signals. The ProjectTree also ensures that the ordering
between the FlatModel and itself is taken into account.
And it makes Node not derive from QObject, saving some memory
in that process.
Task-number: QTCREATORBUG-13756
Change-Id: I8b0d357863f1dc1d2d440ce8172502594138b9fb
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>