Commit Graph

37 Commits

Author SHA1 Message Date
hjk
6d723dfa6f ProjectExplorer: Remove arguments from node change signals
This discourages storing the pointers needlessly. The items
are still easy accessible by the static ProjectTree::currentNode()

Change-Id: I3c0cd019e9fdc382afacbc9d9de3b97d5f58ae1e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-02-24 13:17:46 +00:00
Eike Ziller
dbb2288f1a Merge remote-tracking branch 'origin/4.2'
Conflicts:
	src/shared/qbs

Change-Id: I05c4945d238b7724ca73477fc3b21554564951c0
2017-02-20 15:20:14 +01:00
Orgad Shaneh
cc97609e60 ProjectTree: Remove "external file" warning when node is found
If a new file is added, it is connected to the updateExternalFileWarning
slot before the project tree is refreshed, and is not disconnected until
closing and re-opening it.

Task-number: QTCREATORBUG-17743
Change-Id: Icc7e3fe547a698d6f63116ca148cf1f4f8b60777
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-02-16 10:21:23 +00:00
hjk
3c743346b0 ProjectExplorer: Make the FlatModel a Utils::TreeModel
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>
2017-01-25 13:52:51 +00:00
Tobias Hunger
5d8134f57c ProjectTree: De-duplicate functionality
Change-Id: I465e07c0764ca3dcbf6a6082670b140eb2b01374
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-21 14:22:41 +00:00
Tobias Hunger
ad003363b7 ProjectExplorer: Rename Node::projectNode to Node::parentProjectNode
Change-Id: I47fa794a0bd8456ae23271934a957d9667d2d7bb
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-10 15:24:14 +00:00
Tobias Hunger
c9ee7ee378 ProjectExplorer: Shorten NodeType enum
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>
2016-11-03 15:55:13 +00:00
Ulf Hermann
ea0d3f9ac5 ProjectExplorer: Delete all the widgets when deleting the project tree
Leaving them around is dangerous as they rely on the tree to be valid.
When unloading the plugin the ProjectTree instance is deleted.

Change-Id: Iea6524b0c57c469045cb35f3cd2f376e579b8a57
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-05-30 12:42:16 +00:00
Tobias Hunger
95ac4edfd4 Projectexplorer: Modernize codebase
Change-Id: I4793b58aa77bcd46af99f8b843c0f7439cdc9269
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
Reviewed-by: Vikas Pachdha <vikas.pachdha@theqtcompany.com>
2016-04-15 09:40:53 +00:00
Eike Ziller
7cc1ee395d ProjectTree: Use Utils::equal
Change-Id: Id95f97a61e2ec5d3e0e9b2f3d1e28adfb1002df0
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-03-11 10:44:00 +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
Tobias Hunger
5d7f5a2a32 ProjectNode: Rename path() to filePath()
Change-Id: I78bb73f8c9457fd74c470eacbf54eb9195ac9681
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-11-03 11:01:50 +00:00
Daniel Teske
b82311024d Open Project: Don't show a error dialog for duplicated projects
Instead, switch to edit mode, show sidebar, scroll to project,
and show a tooltip next to the project.

The tooltip is somewhat easy to miss, but this is a clear improvement
in most cases.

Change-Id: Icd27f76e7d434f33e731b6fd56473ff913986a89
Task-number: QTCREATORBUG-8422
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-08-24 11:29:09 +00:00
Daniel Teske
d9425c5cc4 ProjectTree::currentProject: Introduce a fall back to startupProject
If no node is selected, e.g. no document is open, the ProjectTree
currently claims that there is no current project.

This adds a fallback to startup project in that case. This especially
fixes the case where only one project is open and as such it is clear
from context which project the user expects to be current.

Revert a few places where I implemented this fallback manually.

I do not like this. If multiple projects are open, this fallback can be
surprising and not what the user wants. Everything works fine in the
simple case with one project open but breaks with multiple projects
open, this actively hides bugs.

Change-Id: I6259834ca2220dd83bdffb16c3a0eac8f98e504b
Task-number: QTCREATORBUG-14394
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-05-06 11:58:10 +00:00
Daniel Teske
facc89fafd Optimize ProjectTree for adding folders/files
Instead of searching the whole tree for the current node,
only check the newly added files/folders.

Change-Id: I015a955815223767367c4cad476d0620f69abd71
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-03-09 15:47:00 +00:00
Friedemann Kleint
54da18eaaa Clean exported headers of the Core plugin.
Change-Id: I26472d568844d5fee62323e01f5c5c12082d5450
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-03-05 07:18:14 +00:00
Daniel Teske
2ffd0e2d0d ProjectExplorer Nodes: Replace dynamic_cast with as* functions
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>
2015-02-25 14:57:18 +00:00
Orgad Shaneh
88e7f935f4 ProjectExplorer: Use FileName for Node::path
Change-Id: I4a41cfb629be8bb06b4b0616cd4475525e617a51
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-02-13 13:14:03 +00:00
Orgad Shaneh
8683a62419 ProjectExplorer: Fix Collapse All action
The action was triggered after the focused widget was reset.

Change-Id: I093d827472fa608649f98ac1339e957532965c0d
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-02-05 08:10:10 +00:00
Orgad Shaneh
5d1e13fbd2 ProjectExplorer: Use explicit namespace
Change-Id: I923b856170f1c4ddd48da2434bf77d4b46da8d99
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-02-04 10:26:12 +00:00
Orgad Shaneh
98723e4557 De-noise some ProjectExplorer/Utils qualifications
Change-Id: Iaec01ca0e7a43592528bcaf4252540561e109919
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-02-02 13:04:03 +00:00
Daniel Teske
fc3abe9984 ProjectTree: Make project loading fast again
Change-Id: I4a84579311a606d442805acbac2793e8b5ddf515
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-01-22 11:13:59 +01:00
Daniel Teske
783056732b Fix crash on changing project template
D'oh. This boolean needs to be set to true to have any effect.

Task-number: QTCREATORBUG-13848
Change-Id: Idb6559a9b395b3aea4f3379698914b00eb9a031d
Reviewed-by: BogDan Vatra <bogdan@kde.org>
2015-01-19 16:06:43 +01:00
Daniel Teske
230be99474 Fix default wrong directory if no files are open in the editor
Task-number: QTCREATORBUG-13831
Change-Id: Iaeb11014ed16bc9f08d7c12d81c1b7b8a4163d21
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-01-19 13:34:10 +01:00
Daniel Teske
1ed12d39f1 Remove DocumentManager::currentFile, use DocumentManager::currentEditor
Change-Id: Ided1a14481cfbbcc49e901f3837e056582ff60e3
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-01-19 13:34:06 +01:00
Daniel Teske
27fd8d4eb5 ProjectTree: Fix context menu actions
Opening the context menu would move the focus, which then would
reset the current node/project to come from the DocumentManager.

So move the context menu handling code to the ProjectTree class
and ensure that while it is open, the corresponding ProjectTree
is considered the focused widget.

Task-number: QTCREATORBUG-13684
Change-Id: I8b3dc410f5f5bc5e9a2dd663421b22cf3f147190
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-01-15 16:06:45 +01:00
Daniel Teske
b88cdef0a3 ProjectTree: Fix signal emissions for nodes that are not yet mapped
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>
2015-01-15 12:15:48 +01:00
Daniel Teske
70c9c51e5e Refactor ProjectExplorer::Node and remove NodesWatcher
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>
2015-01-14 11:48:12 +01:00
Orgad Shaneh
c6a983d271 Core: Use FileName for file path in IDocument
Change-Id: I85f7398aee59d0d36f0e5c3bf88ff3c96002e394
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-01-12 10:23:37 +01:00
Orgad Shaneh
384641d798 Suppress "file outside the project" warning when there is no project
Change-Id: I46f6e38ba167a85b17ae9f7ac89d5fbbc75abfcd
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
2015-01-08 13:59:57 +01:00
Friedemann Kleint
be7d63c99a Fix build of ProjectExplorer with g++ 4.8.2.
The compiler is unable to match the arguments of the connect
statement when a QPointer is involved.

Change-Id: I87d3c11b9452f07739bf4e905a18071145c4e21d
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-12-19 09:59:47 +01:00
Christian Stenger
dfa76d74e0 ProjectExplorer: Fix compile for Qt version less than 5.4
Change-Id: Ic2500d009d2195d19651ac691c42d55a612fde04
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2014-12-18 14:17:43 +01:00
Daniel Teske
5d2d37b794 Fix crash in ProjectTree on restoring a session
On adding nodes to the node structure, both the FlatModel::nodesAdded
and ProjectTree::nodesAdded code is run. We need to ensure that
FlatModel::nodesAdded is run first though, as we need that information
in the ProjectTree.

Task-number: QTCREATORBUG-13667
Change-Id: I0b4b41ed6036cfdef668c16689d25611633ab0c9
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2014-12-17 17:42:38 +01:00
Nikita Baryshnikov
74c0409d35 Clean up ProjectTree
Denoise namespaces, remove redudant QObject include access to static
instance in nonstatic method

Change-Id: Ic54cd0da90e72a981394996fccd74053a11352e0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-12-15 08:27:58 +01:00
Daniel Teske
5bfd31f09c Fix before exit crash in ProjectTree
When there are 2 top level projects in session, crash happens in
foldersAboutToBeRemoved as currentNode() not properly updated and it
points to previously unloaded dangling node.

Change-Id: Ie3f88bdd03ec042ff1cce6712ed923465c902701
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
2014-12-10 17:16:50 +01:00
Daniel Teske
31f993a011 ProjectTree: Initialize bools with false not 0
Change-Id: I4c02763cea1936df931821bd3e9a0a6a62e2abe9
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-12-08 12:13:01 +01:00
Daniel Teske
4943510b60 Completely rework currentNode/currentProject handling
Centralize the handling inside a new class ProjectTree.
React to moving focus and remove most special handling.

This properly fixes the linked task.

Task-number: QTCREATORBUG-13357
Change-Id: I6b06aa32b1e4305ec8a6d432857b302585d8734b
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2014-12-03 12:36:20 +01:00