Commit Graph

301 Commits

Author SHA1 Message Date
Artem Sokolovskii
51be3be2ea ProjectExplorer: Remove foreach / Q_FOREACH usage part 2
Task-number: QTCREATORBUG-27464
Change-Id: Ibfacf5a3b9789a3cf0ea229d1b0d22639101bf9a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-12 11:12:03 +00:00
Alesandro Portale
e7a0c380d7 ProjectExplorer: Cleanup Window title for the case of no loaded document
When no document is loaded, don't prepend a windowTitleAddition to the
IDE window title.

Fixes: QTCREATORBUG-27328
Change-Id: I283debc2588c6552eaeb9ea23d7df0d07580f9af
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-04-06 12:15:22 +00:00
Alessandro Portale
859fa57648 ProjectExplorer: Sort loaded sessions by time in reverse
Fixes: QTCREATORBUG-26939
Change-Id: I2152dbf7c06dbdc511b4db143efe3375cdad04f1
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-01-27 10:25:36 +00:00
hjk
1fc83d2a56 Utils: Wrap various file system iteration flags and filters
... into a single class.

This makes passing them around as a whole easier, and opens a path
to have "generic" filters in form of a lambda or such.

Change-Id: Ibf644b2fedcf0f1a35258030710afff8f5873f88
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-26 13:13:41 +00:00
hjk
f9c97d23c7 Utils: Add optional recursion for file system iteration
Change-Id: Icded897b129aebd7132376cff55717e16dffc040
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-18 11:52:29 +00:00
Alessandro Portale
a6147a0683 ProjectExplorer: Use a constant for "default" session name
Some duplications of a string may perhaps be fine, but eight occurrences
need a constant. Also, understanding code works better by using the code
model instead of full-text search.

Change-Id: I2944cf9216c825b930dedaae1085491fd10feba5
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-12-25 10:07:35 +00:00
Christian Kandeler
0cc4617c78 CppEditor: Add settings for clangd session mode
Complete with (hidden) UI. Doesn't do anything yet, because some
assumptions about projects need to be adapted on the LanguageClient side
first.

Task-number: QTCREATORBUG-26526
Change-Id: I34c92555e34c3d3ed98462261d47b35dfc015ce0
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-12-01 13:26:35 +00:00
Eike Ziller
dc5717bd06 Move File System view to Core plugin
So it can be accessed from a wider range of places.

Change-Id: I282883addecf7bb070a65d9f4f7b8e6e2e4b5e47
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-27 09:02:23 +00:00
Eike Ziller
258b4f7c23 Show useful root directory when opening File System view
Show the active project's root directory.

Fixes: QTCREATORBUG-26297
Change-Id: Id66131582484e6d8d58ee67226bc1123609e5a7c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-09-30 06:47:42 +00:00
Christian Kandeler
33108795d6 CppTools: Turn some classes into pure value types
ProjectInfo, ProjectPart and ProjectUpdateInfo used to carry pointers
to Project and/or Toolchain, even though they were used in contexts
where these pointers were either unsafe to access or not guaranteed to
be valid anymore, which made their use difficult and error-prone.
We turn these classes into pure value types by copying in all relevant
information before the first async operation takes place.

Fixes: QTCREATORBUG-25678
Change-Id: I1914b0dbda6c7dfba6c95e5e92f2d69977755590
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-08-13 12:35:49 +00:00
hjk
9b250ea2c0 ProjectExplorer: Use FilePath in ProjectExplorer::openProject{,s}()
Change-Id: Ibfb7ab5ef7226b85452bd37b840408708935453b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-07-27 11:35:47 +00:00
hjk
c6dc02313d Core: Filepathify SessionManager::sessions()
Change-Id: I68b6a9f597d3a4f568653e7201a81909053df83e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-01 06:36:02 +00:00
hjk
c0fe038f93 Utils: Simplify FilePath::toFileInfo().lastModified() calls
It's the same as FilePath::lastModified locally, and toFileInfo
doesn't work remotely. So it's overall at least not worse.

Change-Id: Ice8d80dcfd01dc38edc1dce2b53e1b5e6274380f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-06-22 08:57:28 +00:00
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