Commit Graph

288 Commits

Author SHA1 Message Date
Christian Kandeler
201786d3fc ProjectExplorer: Prevent target switch on project that's to be removed
Switching targets starts up a lot of machinery that is undesired for a
project that's going away.
The same goes for switching build configurations on a target that is
being removed.

Fixes: QTCREATORBUG-25655
Change-Id: I0cb6e395cca8f89bfeb70fcdf571bbcb64f94247
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-05-06 10:08:24 +00:00
hjk
8e352af0ec Core: Add a default parameter to various ICore::*path functions
Saves some code on the user side.

Change-Id: I32cd220b6e533f5497a1865f9c34ab9db4cfda79
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-04-27 06:52:05 +00:00
Eike Ziller
c1f90aeca2 ICore: Change some path API to use FilePath
Change-Id: Id841d6177206a021c9e606ce560b47d1ae6e52b9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2021-04-26 08:03:47 +00:00
Alessandro Portale
afc2fda8a9 ProjectExplorer: Use qAsConst w/ non-const Qt containers in range-loops
Change-Id: I6422b3e40a6925504a231be2d47b3214d86c6e06
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-02-17 11:19:21 +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
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
hjk
6164378372 ProjectExplorer: Replace a few foreach()
Change-Id: I445cdfaac13ac894be3cd6fc8c20b4a09f460a01
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-03-02 11:54:00 +00:00
Christian Kandeler
3a0d5cb79a SessionManager: Remember dependencies
... involving projects that aren't currently in the session, for the
purpose of re-establishing the dependency when they get re-added.
In addition to the rather special use case described in the linked task,
this also prevents losing dependency information involving projects that
temporarily fail to load.

Fixes: QTCREATORBUG-22524
Change-Id: I2558736a634e91cccc3f071a3c522b33a88003c0
Reviewed-by: hjk <hjk@qt.io>
2020-01-29 16:47:08 +00:00
Eike Ziller
d755b27c19 Add comments for last session vs startup session
Change-Id: If8b551221c24c74c3415f93400c254528ac57729
Reviewed-by: hjk <hjk@qt.io>
2020-01-08 11:11:13 +00:00
Eike Ziller
6d15080b1e Fix semantics of "-lastsession"
Opening Qt Creator, closing it again, and then opening Qt Creator with
"-lastsession" opened some session - the last session that was opened in
Qt Creator at some earlier time.

The intention of "-lastsession" was more to re-open Qt Creator in the
state it was last closed from, so in this case it makes more sense to
not open a session at all.

Change-Id: Ia33ac5b79d93c7c97865186c56db2ef0b33b9f7c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-01-07 15:38:25 +00:00
Christian Kandeler
1291755288 Session Manager: Do not lose settings made in the default session
The "implicit" default session, that is. See the verbose comment inside
this patch for details.

Fixes: QTCREATORBUG-19388
Change-Id: I270ca25ce3d4c32db51c53de2af055bdfe8c54af
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-01-06 10:59:30 +00:00
hjk
c8137bdcf9 ProjectExplorer: Consolidate some Session::active* accesses
Change-Id: I47b0f6c2c60b2f7c86b6ffd1ad3df393d1321c8b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-11-29 08:39:07 +00:00
hjk
2758682723 ProjectExplorer: Move BuildSystem owership to BuildConfiguration
... or Target.

This patch moves build system from conceptually "one per project"
to "one per target (i.e. per project-and-kit)" or "per
BuildConfigurations" for targets where the builds differ
significantly.

Building requires usually items from the kit (Qt version, compiler,
...) so a target-agnostic build is practically almost always wrong.

Moving the build system to the target also has the potential
to solve issues caused by switching targets while parsing, that
used Project::activeTarget() regularly, with potentially different
results before and after the switch.

This patch might create performance/size regressions when several
targets are set up per project as the build system implementation's
internal data are duplicated in this case.

The idea is to fix that by sharing per-project pieces again in
the project implementation once these problems occur.

Change-Id: I87f640ce418b93175b5029124eaa55f3b8721dca
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-11-19 11:05:52 +00:00
Christian Kandeler
e90a48e639 ProjectExplorer: Fix some problems with plugin unloading
It was not possible to return false from
ProjectExplorerPlugin::initialize() without triggering crashes.

Change-Id: I96b2f80c835e69769f64f9b9c61f473e9ff88623
Reviewed-by: hjk <hjk@qt.io>
2019-10-16 08:16:23 +00:00
Christian Kandeler
dcb1e83002 ProjectExplorer: Make sure the target setup page is shown
... when switching to a project that is unconfigured.

Task-number: QTCREATORBUG-22682
Change-Id: I91c6f791677054d2f86a5a5d81003f38ecc812fb
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-07-15 13:58:54 +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
hjk
92a52a7181 Use Qt's QFileInfoList instead of QList<QFileInfo>
Helps to adapt to potential upstream changes in Qt 6

Change-Id: Ie154bd4fd513d46cb0493758be8943fc4581d71c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-05-28 07:19:45 +00:00
Christian Kandeler
4197746095 ProjectExplorer: Let users delete several sessions at once
Task-number: QTCREATORBUG-17668
Change-Id: I90dea6721ef8e7c1496f3a2c934f74edb62bbc96
Reviewed-by: hjk <hjk@qt.io>
2019-05-09 14:54:56 +00:00
Christian Kandeler
6798cf0b9f ProjectExplorer: Add unit test for session switching
Checking some basic invariants, plus a small stress test

Task-number: QTCREATORBUG-20975
Change-Id: I975d0b96ade8a81c1358387927e4fe5a98d25892
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-04-29 09:00:38 +00:00
Christian Kandeler
089734a6c8 ProjectExplorer: Remove repeated call to processEvents()
If the second call really serves a purpose, we will find out eventually
and can add it back in with a proper comment.

Change-Id: Id4db1e59d771578f0eceebb6829ecf12e7da4d49
Reviewed-by: hjk <hjk@qt.io>
2019-04-26 15:03:45 +00:00
Alessandro Portale
616e19ff9e Fix warning: "Missing emit keyword on signal call"
[-Wclazy-incorrect-emit]

Change-Id: I93bdc6e23cdaccf35c9899ae16870ccc65a54f80
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-01-17 15:54:56 +00:00
Tobias Hunger
80c2ce118d ProjectExplorer: Modernize even more
Use unique_ptr for all *Private classes, except for those
in singletons.

Change-Id: Ib56c31ddedc6e9cf321f15de1f1e697a27ad4089
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-07-24 09:04:54 +00:00
hjk
c43100c601 ProjectExplorer: Simplify SessionManager::markSessionFileDirty(bool)
It did nothing if false was passed. So do not call it in that
case and drop the parameter.

Change-Id: I9b055cb0c0c8be85d528247a269fb7fea062326b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-05-28 07:36:52 +00:00
Eike Ziller
cef50e4166 Fix removal of projects from file system view
The destruction of a project can still trigger file list changes, so
just check if the project is actually still registered before updating
anything.

Task-number: QTCREATORBUG-20314
Change-Id: I0d634ca8986d1f09e84c310ae732c0bcdc675534
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-20 11:46:05 +00:00
Tobias Hunger
58899a6b70 Session: QTC_CHECK that projects are fully set up
Do QTC_CHECK to warn if a new project is not fully set up.

Change-Id: Iafeac9ed5bd62bd57754015aed832848e50b037a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-01-10 13:28:24 +00:00
Tobias Hunger
7c35a38100 Session: Move all functionality related to Nodes into ProjectTree
Do no longer expose Nodes from the SessionManager's API. These are now
exclusively handled by the ProjectTree.

Change-Id: I585c2ac919462073870363436e767640775d9045
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-12-12 13:44:09 +00:00
Tobias Hunger
9d3c5c6ff5 Session: Remove projectContainsFile
Use Project::isKnownFile instead.

Change-Id: If69e413e4603fe6d7dc359ecd55d6233d9a3a642
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-12-08 11:14:21 +00:00
Tobias Hunger
43f57d3f31 Session: Get rid of cache of all project file names
Make the project responsible to provide information on which files
belong to it instead.

Change-Id: I80accf9104af33eaffc6b8f3e6024e9725697d37
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-12-08 11:13:34 +00:00
Tobias Hunger
18f38ff18e Project: Make Project::files return a FileNameList
Change-Id: I75ceb22ac65b8288d824f229d44089cba6fc8ea3
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-12-08 09:09:59 +00:00
Tobias Hunger
2a8d5efc35 Session: Sort includes
Sort includes to shut up codemodel.

Change-Id: I03b980b8cd0a7c9da21f4e730558256548cb8a8a
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-12-06 08:47:44 +00:00
Hugo Holgersson
990ce20523 EditorManager: Sprinkle const over the window title logic
This amends 2ab5561b9a.

Change-Id: Ic7c36348e88b72d6c1fed75ca149958be332345e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-11-05 10:07:59 +00:00
Eike Ziller
7f626b1182 Merge remote-tracking branch 'origin/4.5'
Change-Id: Iceaa4ca40b5318744bde8a76c6d3ccca08df71bb
2017-10-25 16:07:21 +02:00
Tobias Hunger
a646196011 Session: Fix (un)loading of projects on session change
Task-number: QTCREATORBUG-19078
Change-Id: I4f527cb3af9b9270a65da1e283e8a1f3db737531
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-24 11:14:13 +00:00
Eike Ziller
1c1dd45bfe Merge remote-tracking branch 'origin/4.5'
Change-Id: Iebd340258966aff910fb9ab0e45b5149e8f242f0
2017-10-12 09:49:14 +02:00
Eike Ziller
1932912e7c Add icons to file system view directory selector
Change-Id: I0b6451d7f68fae93e0b140aaea030c88ec1a8801
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2017-10-11 07:06:41 +00:00
Eike Ziller
07bec99e8f Merge remote-tracking branch 'origin/4.5'
Conflicts:
	src/plugins/debugger/debuggerruncontrol.cpp
	src/plugins/projectexplorer/gcctoolchain.cpp

Change-Id: Iaad0659293681cce4266fc3e4ba2a4f2068de911
2017-10-09 12:09:27 +02:00
Tobias Hunger
4d32f3b7ce Session: Delay deletion of projects till all signals are processed
Delay actual deletion of projects till all signals related to the
removal event (incl. the startupProjectChanged signal) are handled.

Change-Id: I8e2c8db49f732b80234a3cfa81d73f17c8d02608
Reviewed-by: hjk <hjk@qt.io>
2017-10-06 10:52:54 +00:00
Tobias Hunger
033b641373 Session: Make sure startupProject is set whenever a project is open
Never let the startupProject become nullptr while projects are still loaded.

Change-Id: Ie442c3a9b6cc4a65564002edc45b60a7993d2a52
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-05 08:15:03 +00:00
Ulf Hermann
0693db3579 SessionManager: set startup project on addProject
If there is no startup project when we add a new project the new project
should become the startup project, as a situation where there are
projects, but no startup project is invalid. removeProject also checks
for the startupProject and adjusts it if necessary.

Change-Id: I5f12add832db82af553fc1e393e32185eb322866
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-10-04 10:49:29 +00:00
Tobias Hunger
f8ded0df26 SessionManager: Modernize code a bit
Change-Id: I9e44990c62ccca8e06919576bb9be463bb84cf19
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-04 09:50:00 +00:00
Tobias Hunger
db5a00231f Session: Fix removal of projects
When removing a project setStartupProject(nullptr) may fail, since
it will reject any attempt to set the startupProject to nullptr while
any project is still available.

So delay this till nullptr is an option:-)

Change-Id: I6f41a17d922cf6333b7b7e17f8300e831e4807d9
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-04 09:49:52 +00:00
Eike Ziller
e3a692a1a4 File System view: Fix that projects could be duplicated
It is not possible to use the display name as an ID, because that can
change (and to propagate that change we use the ID).
Remove the display name from the ID, use a separate sort property, and
sort by this property + display name.

Task-number: QTCREATORBUG-18972
Change-Id: I27017473842931defa3a123ce9f41cc8e8ba1a61
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-27 12:37:53 +00:00
Eike Ziller
f5f4ebff73 Update project names in file system navigation pane
When the project reports a change in the display name we need to update
the drop down in the file system navigation pane as well.

Task-number: QTCREATORBUG-18972
Change-Id: Icfc0e6b2185f147bfc36589d8aea13a0966e8793
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-26 11:03:41 +00:00
Eike Ziller
f292a5e45b Add projects directory to folder navigation widget
Change-Id: Ia925fa99ba0f11be860f214e7809731ddf990268
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-26 11:03:31 +00:00
Eike Ziller
08aa833825 Sort root directories in file system view
Change-Id: I8ce68ffa4752c89de735583640103bc22c2a8bc7
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-26 11:03:16 +00:00
Eike Ziller
3c988e5a0d Change File System pane to a forest of trees
It shows the file system as a tree, where the user can change the root
directory of the view. Currently there are "Computer" (the default), and
all project directories.
If synchronization with the current editor is enabled, the view
automatically switches to the best fitting root directory.

Task-number: QTCREATORBUG-8305
Change-Id: Ic265eb49b1e8e0fd8cdeeb4fb1c64b8631f32e21
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-18 09:15:23 +00:00
Ulf Hermann
47886969cc Drop unused variables and lambda captures
Also, add context to connect() expressions where we are or were
capturing "this".

Change-Id: I6e006ba6f83d532478018550d148ee93eca59605
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2017-09-08 09:06:53 +00:00
Orgad Shaneh
1f443bde52 Replace QFileInfo(fileName.toString()) with fileName.toFileInfo()
Change-Id: Iac7f866b4846939af4dcee086ab07797cc6b8ff1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-08-24 08:54:16 +00:00
Orgad Shaneh
f6c6224ebc Autotest: Avoid needless iterations over the project files
Task-number: QTCREATORBUG-18185
Change-Id: I6c541cfa577331edc1ff3083d2f9b705ffc7ce73
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-05-11 06:04:15 +00:00
Tobias Hunger
28c8da4f90 Session: Emit signal when project's displaynames change
Task-number: QTCREATORBUG-17957
Change-Id: I3fcbe2171e359f71434c6162d012e64f70efce99
Reviewed-by: hjk <hjk@qt.io>
2017-04-07 14:31:26 +00:00