Commit Graph

143 Commits

Author SHA1 Message Date
Christian Kandeler
02785342ac Fix some clang warnings about unused lambda captures
There are more, but we need to keep those because MSVC believes they are
required. This is the subset that satisifies both compilers.

Change-Id: I0b0a63d5496acc119a7f0513d3a1da0b76fa1fca
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-04-24 08:44:58 +00:00
Ville Nummela
1194340b85 Disable "Save All" when there are no documents to be saved
Fixes: QTCREATORBUG-22072
Change-Id: I6c84e0004d1ada27bfcec59f509d066f1b03ca2c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-03-30 07:52:40 +00:00
David Schulz
cc02d8dd0d Core: Do not save temporary documents when building
Change-Id: I9be6bf90d6a44b62e783964bc88870dc97b7b6e3
Fixes: QTCREATORBUG-23509
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-03-24 12:55:54 +00:00
Leena Miettinen
e3581a3961 Doc: Fix Document Manager docs
Task-number: QTCREATORBUG-23620
Change-Id: I7c70398008e9c8855beef9b2239e1a7431904076
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-03-23 08:29:22 +00:00
Alessandro Portale
9904464074 Make various Q_LOGGING_CATEGORY's static
Change-Id: I43d3a198b0863d85a7fb305c7cb768f68acbd139
Reviewed-by: hjk <hjk@qt.io>
2020-01-15 14:54:10 +00:00
Nikolai Kosjar
16e61cdf82 Utils: Simplify
bugprone-branch-clone
readability-simplify-boolean-expr

Change-Id: I75ad6118275ad9231f21b578567c3c042414263b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-11-01 09:10:31 +00:00
hjk
ddf0dd8734 Utils: Add a FilePath::isDir() convenience function
Change-Id: I1df0ee1b136299ae6e4f2e5bd0bdc24bfeca33dd
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-09-11 12:46:10 +00:00
hjk
e3b1106afa Compile fix with recent Qt dev
The reasoning in 1b4766e26c did not take into account that the scope
of QT_NO_JAVA_STYLE_ITERATORS may change over time, as done with
f70905448f6 in Qt base.

Change-Id: Ib1966ff26c4d36d5f62e149d6b45baa4aecf825d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-29 08:54:18 +00:00
Tim Jenssen
1df6443d4a Merge remote-tracking branch 'origin/4.10'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/libs/utils/synchronousprocess.cpp
	src/plugins/baremetal/iarewtoolchain.cpp
	src/plugins/cmakeprojectmanager/cmakeproject.cpp
	tests/unit/unittest/CMakeLists.txt

Change-Id: I124ad492df403286751e175d27fe36487ddf6d07
2019-07-04 15:17:55 +02:00
Christian Kandeler
bf0d84074f Let users configure the number of recent files shown
Fixes: QTCREATORBUG-21898
Change-Id: Ie804e722f9bb88762da57f157833e4dc43d8ccbf
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-03 09:09:06 +00:00
hjk
36fcd52136 Utils: Add toSet/toList functions
As replacement for functionality that's being deprecated
in Qt but still useful or needed, or that cannot easily be handled
without resorting to #if QT_VERSION checks in user code.

Change-Id: Id3575a54ff944bf0e89d452d13944fcaee270208
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-02 12:48:54 +00:00
Christian Kandeler
1a416840a1 DocumentManager: Fix off-by-one error in max number of recent files
Also update the value so we don't introduce a behavior change.

Change-Id: Ie6d474c0d62f041afd84acdd90c1c09d23c57d46
Reviewed-by: hjk <hjk@qt.io>
2019-07-01 11:51:16 +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
Tim Jenssen
a78e3e5dd5 use initializer lists
Change-Id: I82b04601f1db52197b3dc625b6b7e0f143c1c8b6
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-01-21 15:10:54 +00:00
Eike Ziller
845af92889 Merge remote-tracking branch 'origin/4.8'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri

Change-Id: Iaec96f929230754b87b32c2588db5cac5acd8453
2019-01-21 08:54:49 +01:00
Eike Ziller
d8920f923f Fix crash with reload prompt in presence of modal dialog
When a modal dialog is open, we delay the opening of the reload prompt,
which is good.
We should not directly open the reload prompt while processing a focus
change signal, because that will interfere too much with the focus
itself. Queue the signal processing.

Fixes: QDS-381
Change-Id: I8973aa986de5a46bf874529cbbda0b325222fcac
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2019-01-18 16:30:15 +00:00
Orgad Shaneh
c225216b93 Utils: Introduce GlobalFileChangeBlocker
Tracks application state, and signals when it is changed.

Supports forcing blocked state with reference counting.

Change-Id: Ic173d42446b1b08bd4a1e7c1acf38c68644d30b3
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-01-08 14:21:39 +00:00
Orgad Shaneh
7096649fc2 Merge remote-tracking branch 'origin/4.8'
Change-Id: I5b18233936e3b2cd674df92a694ba73b5a3ed752
2018-12-03 09:56:07 +02:00
Orgad Shaneh
d1a4e10fba Core: Use correct parent for fileDeletedPrompt
Fixes: QTCREATORBUG-21607
Change-Id: Ibf1ba7440cd1cbcd746b1be60a6058b86692ca2b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-11-29 15:38:51 +00:00
Eike Ziller
511bd64f3f Merge remote-tracking branch 'origin/4.8'
Change-Id: I0ff6f659b7ccd4ff5a79e422a1d54488508fe05f
2018-10-16 07:11:57 +02:00
Orgad Shaneh
bdc2b4b59f Remove hard-coded disabling of debug logs
Instead, set the default level of all logs to QtWarningMsg.

The call to setFilterRules overrides the user preferences in qtlogging.ini.

Change-Id: Id5f6cd550d14ff7f45ae04c5d3110e0bafb0f072
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-10-13 16:36:58 +00:00
Tobias Hunger
a43331ba67 Move "builddirectory" template from Core to ProjectExplorer
Move Core::DocumentManager::buildDirectory to
ProjectExplorerPlugin::buildDirectoryTemplate.

Move the setter along.

Change-Id: I3f1739723e800d04d2934149369b8881208305b4
Reviewed-by: hjk <hjk@qt.io>
2018-10-10 08:31:16 +00:00
Robert Loehning
da6c7972b0 DocumentManager: Follow clazy's suggestion to use QHash instead of QMap
Change-Id: Icdae5e06db43c75408522d6331b4c56433a09ca9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-09-06 10:06:33 +00:00
Alessandro Portale
f36f04deba Core: Modernize
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init (partially)

Change-Id: Idf10d7ffb1d98a04edc09a25c35e4e9e3abe87b5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-08-08 16:04:21 +00:00
Tim Jenssen
0387fc0f93 use initializer list
Change-Id: I15fdcf313db913df91a1a93684e1d60de7bf16bd
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-07-10 09:54:02 +00:00
Orgad Shaneh
b82ffb917b VcsCommand: Block auto reload while a command is running
Git rebase is executed in the background, and it can change a file multiple
times in a short period. If we reparse a file while this happens on
Windows, Git fails to replace it, the rebase action fails and the
repository becomes unstable (remains with a modified file).

See discussion at https://github.com/git-for-windows/git/pull/1666

Task-number: QTCREATORBUG-15449
Change-Id: Iba40a770a1df2dfff0dd1c874c491dfbe1cceb58
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-06-27 09:43:47 +00:00
Andre Hartmann
9467ed42c3 Add a file properties dialog
Task-number: QTCREATORBUG-19588
Change-Id: I75599459beb7e23812ba48670ae968585faefda9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-02-19 09:14:28 +00:00
hjk
cc88302309 De-emphasize PluginManager::getObjects<Type>()
... by additionally keeping local (currently non-owning) pools per
"interesting" type.

Current situation:
  - The global object pool does not scale well for looking up
    objects, as iteration plus qobject_cast typically iterates
    over all pooled objects.
  - User code that can use typed results from the object
    pool need to have access to the full type definition anyway,
    i.e.  depend on the plugin of the target class anyway.

The patch here solves the scaling problem is to have local
type-specific pools to which objects register in their
constructors and deregister in their destructors.

This patch here does *not* change the ownership model of the
pooled objects, however, it opens the possibility to change
the ownership model per type (e.g. by not putting things into
the global pool at all anymore and make the local pool 'owning')
and the intent is to handle that in later patchs.

Even without the follow-up patches this here is a performance
improvement for the cases that access the local pools instead
the global one, i.e. "practically all".

Change-Id: Ib11a42df2c4ecf5e1155534730083a520dd1995b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-12-15 07:08:05 +00:00
Eike Ziller
cc94548999 Add function for getting DiffService
Hides the implementation detail that this is fetched from the object
pool from most places.

Change-Id: I0ea06c877fade50f62b62011bbc0d2f89fa8e885
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2017-11-13 07:48:29 +00:00
Eike Ziller
2d5d62fdbc Restrict suggested file filters to registered supported mime types
When using File > Open File or Project, and with Save As.
It was containing all mime types registered in Qt Creator, including the
default one from freedesktop.org, most of them being not interesting.

Task-number: QTCREATORBUG-17913
Change-Id: Ic5e49b27b566eb41419240b78a6cd99b233aeb07
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-01 15:17:39 +00:00
Eike Ziller
c99b8c2fd1 DocumentManager: Avoid unneeded allocation of potentially large list
Change-Id: I454f2cbf78e76ba7e86febcd9aa0ecd003edb3fa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-10-19 15:58:30 +00:00
Eike Ziller
5e622a3203 Use nullptr and member initialization in document manager
Change-Id: Iddd446d10cf3fd0a59d46d6ed3ba335f0c93e118
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-29 10:46:28 +00:00
Eike Ziller
e0639d0696 Fix reload issues for files with multiple registered documents
If a file is removed, the file system watcher can loose its watch
on it (e.g. on Linux, inode-based).
Saving files does so "safely" by writing a temporary file, moving
the original, and moving the new file in its place, which is
triggering the issue above. That is why we need to re-register
the path in the file system watcher.

This broke in the refactoring done
by 05485071b0

Task-number: QTCREATORBUG-18892
Change-Id: I3b216d614b9f82e308da63c07d990e5911193655
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-29 06:48:49 +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
8e62881b12 Make DocumentManager::projectsDirectory a FileName
Change-Id: I9454c2148c398939c64bfa6b1fc182670a1d5f99
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-19 10:13:49 +00:00
Eike Ziller
05485071b0 Handle case sensitive file system gracefully with case-insensitive setup
If you use a case sensitive file system with a Qt Creator that is set to
case insensitive file system handling (default on Windows and macOS),
we still want file change notifications to work as long as you do not
actually have files that only differ in case.

This requires us to carefully differentiate between the keys that are
used for comparing files (=> case insensitive), and the paths that are
registered in the file watcher (=> file path as we get it from the
user).

Also for the check if a file path is a symlink, we should not check
equality of the resolved vs unresolved keys, but equality of the
cleaned, absolute paths (resolved vs unresolved).

Task-number: QTCREATORBUG-17929
Task-number: QTCREATORBUG-18672
Task-number: QTCREATORBUG-18678
Change-Id: I36b8b034880a0c60765a934b3c9e83316c4eb367
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-05 10:53:08 +00:00
hjk
3f5caf4cdc Utils: Wrap MimeDatabase into static functions
To avoid repeating the 'MimeDatabase mdb; mdb.something(); ' mantra
all over the place.

Change-Id: I4bfef62e73275a991455141671d6071162788e9d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-03-03 07:57:54 +00:00
Orgad Shaneh
7b3642cce4 Merge remote-tracking branch 'origin/4.2'
Change-Id: I259a402bc896fc2e359cc96b7510453ac9a9a552
2016-11-28 15:27:51 +02:00
Friedemann Kleint
14eadb0f6d Fix accessing temporary copies via QStringRef
Amends change 840e787175

Change-Id: I633500b0fdbeeeb8b3d8accd3aec1e2990c62bca
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-11-28 08:25:14 +00:00
Friedemann Kleint
840e787175 Use QString::splitRef() instead of QString::split()
Avoid string allocation where it seems feasible.

Change-Id: I61b23d4ef8a459f5aa77727a75f4e1d2b140da3b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-25 11:32:47 +00:00
Eike Ziller
fc69e4ef54 Fix that it was not possible to save with arbitrary file extension
On Windows.

Task-number: QTCREATORBUG-15862
Change-Id: I5cc76662e4996bfa26eece09f2e30dc3ce873eb5
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-11-15 11:39:12 +00:00
Eike Ziller
b5f587efb5 Fix that save as from "file was removed" dialog didn't provide filters
Also removes some code duplication.

Change-Id: I4f4616717f2eb37a1c73accdfa81e6d0dae6809f
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-11-14 09:03:29 +00:00
Jarek Kobus
1414826183 Implement diff on close, on revert and on external modification
Task-number: QTCREATORBUG-1531
Change-Id: I8c9a740d66eb7836b3df6850ac243260fd282b32
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-21 09:20:20 +00:00
Jarek Kobus
ca4be197ef Revert "Replace virtual isModified method with a getter/setter/notifier"
This doesn't fix the issue with cleaning the clear state of undo stack.
This introduced the issue when ui file is opened it's marked as modified.
It reverts 59c90e00c1
and d0c537ca75

Change-Id: Ifd4ff8483d6c297461632de500a4502b1fd0871f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-21 09:19:56 +00:00
Jarek Kobus
d0c537ca75 Mark file modified externally as modified after the prompt
In case when the user has chosen not to reload the file.

Task-number: QTCREATORBUG-17048
Change-Id: I4eb78af2dbc655ab5e0f3fa19f506aa2302d7877
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-17 14:44:36 +00:00
Alessandro Portale
d8e94afb51 Core: Native dir separators for DMgr::getSaveFileName warning
User visible paths need native ones.

Change-Id: I4fbadd9cf63fbb9c513b45eb6001107dbc162f86
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-08-08 18:48:01 +00:00
Orgad Shaneh
08f807a134 Core: Use a consistent initial directory in open/save/locator
Use fileDialogInitialDirectory() for all of them.

Conditionally initialize lastVisitedDirectory to projects directory to
preserve existing behavior on Open, when no project is open yet.

Change-Id: I318a7c7741e70a68758f0cc068ce956135103f3f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-05-04 09:42:14 +00:00
Eike Ziller
16c7a262cc DocumentManager: Fix issues with handling of externally modified files
Use ApplicationState and ApplicationStateChange event instead of
deprecated ApplicationActivate event and unreliable
QApplication::activeWindow(). That fixes an issue where the file change
dialog was not shown after closing a modal dialog on Linux, because
there the activeWindow is temporarily set to 0 for some reason.

Also avoid excessive timer. Modifying a file that is open in Qt Creator
should not result in the system waking up 5 times a second afterwards.

Task-number: QTCREATORBUG-15687
Change-Id: I105d08cd590cc3c8ee5d8efdc568ad5fd2be0857
Reviewed-by: Robert Loehning <robert.loehning@theqtcompany.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-03-04 10:49:15 +00:00
Orgad Shaneh
5646480f27 Core: Use Qt5-style connects
The heavy lifting was done by clazy.

Change-Id: I2dde14919d917816d02117338205f8f861d8af0a
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-02-03 07:54:02 +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