Commit Graph

130 Commits

Author SHA1 Message Date
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
Eike Ziller
cfc89a685e IDocument: Rename defaultPath and suggestedFileName
To fallbackSaveAsPath and fallbackSaveAsFileName. That makes it clearer
what they are for, and that they actually belong to each other.

Change-Id: Ie5b83b9db77d39a7fe9e979cc8f22b7f5b9101a3
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-01-14 14:40:45 +00:00
Eike Ziller
29c7bcdf7e Revert "Core: Reinitialize change notification after saving"
This reverts commit 540f5677e8.
For some reason the change broke reparsing of .pro files after
they are edited.

Change-Id: I61560d3d7a3ccd8aac72c80b37421ed924f2323c
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
2015-07-06 11:04:16 +00:00
Finn Brudal
540f5677e8 Core: Reinitialize change notification after saving
When saving a version controlled file, a new version might be created.
Therefore, ensure that the current file version is being monitored.

Change-Id: Icad41bc5a443561de0c0e878aa893913dc674173
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-06-15 06:59:18 +00:00
Nikolai Kosjar
7050f78b8d Core: Make EditorManager::reloadSettings available for tests
Needed for a test in ClangCodeModel in order to avoid a blocking pop-up
dialog.

Change-Id: I5a337cfcbf514052681f1941845a995d2a5856ac
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-06-03 08:59:06 +00:00
Eike Ziller
697479572f Move Open With... handling to editor manager.
Change-Id: I27faa327ae33244927e21aa74875d9601aaf9e50
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2015-06-02 07:00:50 +00:00
Eike Ziller
2e4a86a87c Simplify Open with... menu handling
In the light of lambdas we can get rid of some complexity.

Change-Id: Id28b52c42d7c34526c93785723387b6c44c0cd52
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
Reviewed-by: Nikita Baryshnikov <nib952051@gmail.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2015-06-02 07:00:31 +00:00
Tobias Hunger
972a306d56 DocumentManager: Treat documents without path as temporary
Treat documents without path as temporary when trying to come up
with a directory to open the file dialog in.

Task-number: QTCREATORBUG-14131
Change-Id: I266fe6608b7c98b479f86412a0892413e1b99bb2
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-03-16 13:51:26 +00:00
Eike Ziller
5a3a940ad3 Use new mime database
Change-Id: I4305872b6b11ef3e8a364280ffa5209a5a793600
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-02-17 13:00:07 +00:00
Eike Ziller
9926fc2ab1 Merge commit '3c85058694ee2e41658d17f524fb48f0b187d2fe'
Conflicts:
	src/libs/utils/tooltip/tipcontents.cpp
	src/libs/utils/tooltip/tipcontents.h
	src/plugins/android/androiddeployqtstep.cpp
	src/plugins/baremetal/baremetalconstants.h
	src/plugins/baremetal/baremetaldevice.cpp
	src/plugins/baremetal/baremetaldevice.h
	src/plugins/baremetal/baremetaldeviceconfigurationwidget.cpp
	src/plugins/baremetal/baremetaldeviceconfigurationwidget.h
	src/plugins/baremetal/baremetaldeviceconfigurationwizard.cpp
	src/plugins/baremetal/baremetaldeviceconfigurationwizardpages.cpp
	src/plugins/baremetal/baremetaldeviceconfigurationwizardpages.h
	src/plugins/baremetal/baremetalplugin.cpp
	src/plugins/baremetal/baremetalplugin.h
	src/plugins/baremetal/baremetalruncontrolfactory.cpp
	src/plugins/baremetal/baremetalruncontrolfactory.h
	src/plugins/cppeditor/cppcodemodelinspectordialog.cpp
	src/plugins/cppeditor/cppdoxygen_test.cpp
	src/plugins/cppeditor/cppdoxygen_test.h
	src/plugins/debugger/breakpointmarker.cpp
	src/plugins/debugger/debuggeritemmodel.cpp
	src/plugins/debugger/debuggeritemmodel.h
	src/plugins/debugger/loadcoredialog.cpp
	src/plugins/genericprojectmanager/cppmodelmanagerhelper.cpp
	src/plugins/projectexplorer/addnewmodel.cpp
	src/plugins/projectexplorer/addnewmodel.h
	src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp
	src/plugins/qmlprofiler/abstracttimelinemodel.cpp
	src/plugins/qmlprofiler/abstracttimelinemodel.h
	src/plugins/qmlprofiler/notesmodel.cpp
	src/plugins/qmlprofiler/qml/CategoryLabel.qml
	src/plugins/qmlprofiler/qml/MainView.qml
	src/plugins/qmlprofiler/qml/Overview.js
	src/plugins/qmlprofiler/qml/Overview.qml
	src/plugins/qmlprofiler/qml/TimeDisplay.qml
	src/plugins/qmlprofiler/qml/TimeMarks.qml
	src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp
	src/plugins/qmlprofiler/sortedtimelinemodel.cpp
	src/plugins/qmlprofiler/sortedtimelinemodel.h
	src/plugins/qmlprofiler/timelinemodelaggregator.cpp
	src/plugins/qmlprofiler/timelinemodelaggregator.h
	src/plugins/qmlprofiler/timelinerenderer.cpp
	src/plugins/qmlprofiler/timelinerenderer.h
	src/plugins/qmlprojectmanager/QmlProjectManager.json.in
	src/plugins/texteditor/findinfiles.cpp
	src/plugins/vcsbase/vcsconfigurationpage.cpp
	src/shared/qbs
	src/shared/scriptwrapper/interface_wrap_helpers.h
	src/shared/scriptwrapper/wrap_helpers.h
	tests/auto/qmlprofiler/abstracttimelinemodel/tst_abstracttimelinemodel.cpp
	tests/system/suite_debugger/tst_debug_empty_main/test.py
	tests/system/suite_debugger/tst_qml_js_console/test.py
	tests/system/suite_debugger/tst_qml_locals/test.py

Change-Id: I67540b648f8b162496f4aa606b04d50c7c9125c6
2015-02-12 17:29:21 +01:00
Orgad Shaneh
6102b2d697 Core: De-noise DocumentManager
Change-Id: I5b78e5ac76829a8921039663edab2b8f836c0c7e
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-02-11 08:53:12 +00:00
Orgad Shaneh
428565cb02 Core: Remove unneeded qualifications
Mostly done using the following ruby script:
Dir.glob('**/*.cpp').each { |file|
  next if file =~ %r{src/shared/qbs|/qmljs/}
  s = File.read(file)
  s.scan(/^using namespace (.*);$/) {
    ns = $1
    t = s.gsub(/^(.*)\b#{ns}::((?!Const)[A-Z])/) { |m|
      before = $1
      char = $2
      if before =~ /"|\/\/|\\|using|SIGNAL|SLOT|Q_/
        m
      else
        before + char
      end
    }
    if t != s
      puts file
      File.open(file, 'w').write(t)
    end
  }
}

Change-Id: I5c6690f51488bf8ca3610ba9fb11e6e5fd814aaa
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-02-06 09:06:18 +00:00
Orgad Shaneh
1bcfa137a3 Do not use QDir::separator() for internal paths
Internal paths are supposed to be normalized

Change-Id: Ic6943ce13ad389dfdb44054a9e6f03da8c6cd88d
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-02-02 08:32:59 +00:00
Orgad Shaneh
a9014e074d Utils: Use FileName in reloadPrompt
Change-Id: I170208e1c49bcab9c78b1651669252ed0d162bb3
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2015-02-02 07:02:59 +00:00