Commit Graph

317 Commits

Author SHA1 Message Date
Alessandro Portale
64aaf66c3b Proliferate Tr::tr in various places
This changes several tr() calls which were either missed during Tr::tr-
ization or were added later.

Found with regular expression: (?<!(Tr::)|([\w]))tr\(

Change-Id: I1c0c03589e941614a7a8449ecfebc7d2cad396c3
Reviewed-by: hjk <hjk@qt.io>
2023-02-10 16:27:19 +00:00
hjk
c5f7f5ab0a ProjectExplorer: Tr::tr
Change-Id: I8f1b463c5cc7a53627f7a9ad261998b92f13e56a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-16 12:10:24 +00:00
Christian Kandeler
22da0f2fd6 ProjectExplorer: Try harder to find a project for a source file
While project files should ideally list all their source files, this is in
practice not always the case. In particular, a lot of cmake projects do
not bother to list their headers. Therefore, we amend
SessionManager::projectForFile() such that it also considers unlisted
files in a project source directory (but not in a build directory, i.e.
projects with in-source builds are not considered).
A user-visible effect is that when renaming C/C++ symbols, occurrences in
unlisted headers are now pre-selected.

Change-Id: Id9f64f4836d2bb4dba80e111489f6c14ebb322ed
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-11 14:39:58 +00:00
hjk
66c08a824d Utils: Rename most FilePath::{from,to}Variant uses to {from,to}Settings
Specifies the main purpose more clearly. The remaining ones a "true"
(internal) variants in models and as action data.

Change-Id: I8dd3c846e419f29d88283c2f48268ef6685b19fe
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-10 09:00:30 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
hjk
4b237c0e98 ProjectExplorer: Return FilePaths for SessionManager::projectsForSessionName()
Change-Id: Ie168973e872ea105c7eb46ff7f58fb34883364b1
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-05 11:07:14 +00:00
hjk
e70658d9e9 ProjectExplorer: Use more FilePath in session handling
Change-Id: Ia457bcaa1faa72a34998915d7648587595bd342d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-10 15:44:18 +00:00
Christian Kandeler
d77a7167db ProjectExplorer: Use LRU for sorting sessions in menu
Right now, upon start-up of Qt Creator, entries in the Sessions menu are
sorted in reverse order of the time the corresponding files were last
modified on disk, which often (but not always) corresponds to a "least
recently used" order. This order is unchanged during the lifetime of the
current instance of Qt Creator, and potentially changes again after the
next start.
As this can be confusing to users, we now ensure LRU sorting at all
times.

Task-number: QTCREATORBUG-28202
Change-Id: I758371ac1cb968dd3f2e4278fc5066d1e74397c6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-10-21 11:34:20 +00:00
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +00:00
Jarek Kobus
898053533a ProjectExplorer: Limit the usage of qMakePair
Make the code less verbose.

Change-Id: If9fe08a6a7538d34c80ca97a2aec21a2bd6e5d22
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-04 09:02:22 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Marcus Tillmanns
04205d1225 FileUtils: Adds toFilePathList function
Change-Id: Ie3137751135fdb6c3161cc886f307323fcce6b72
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-08-04 11:33:53 +00:00
hjk
fdf92b67b5 ProjectExplorer: Use FilePath for Recent projects
Change-Id: Ifaf893358d4fbe20696b39b795434cb51a3e29d4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-07-28 09:31:37 +00:00
hjk
df358c7833 ProjectExplorer: Remove unneeded #include in projectexplorer.h
And fix side effects.

Change-Id: Ib6f0c5618092f80204b409edec0a92004f2350d2
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-07-27 11:56:09 +00:00
hjk
2496ffe3ce Code cosmetics
Mostly unused #include's, also sort them or reduce scope.

A few namespaces, ...

Change-Id: I9ee71e07de7157c9942125672addf87dd41e78f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-06-24 14:44:13 +00:00
David Schulz
e052d75987 Core: FilePathify WindowTitleHandler
Change-Id: I905a193e70b199cbbd483e76e14c7f9fd2b179ef
Reviewed-by: hjk <hjk@qt.io>
2022-06-17 04:22:23 +00:00
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