Otherwise when we switch session we still keep
the data about the old session in the cache, which is pointless.
Protect clearing both caches with both mutexes, so it comes
atomically.
Task-number: QTCREATORBUG-25317
Change-Id: Ic5bc7ae2b8640e9290024e00c394ca9608f88da9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
We had three different hashes that cached the document data.
Replace it with one cache. Provide a dedicated structure for it.
Task-number: QTCREATORBUG-25317
Change-Id: I6592de62b7c026a9236a295657c9c06f6e9e5b4c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
We had three different hashes that cached the project data.
Replace it with one cache. Provide a dedicated structure for it.
Task-number: QTCREATORBUG-25317
Change-Id: Ib6bafd38ee3c48f3e4960be1650709af777f255a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Instead of clearing the project's file list completely,
remove just a project (in case a removed file was a project)
and remove from all project's lists the removed file (in case
a removed file was contained in any project).
Task-number: QTCREATORBUG-25317
Change-Id: I63a5f9eb1043bd0d9b835d55f4a16f7f6af7bc6e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
After fixing QTCREATORBUG-17977 we don't have Subprojects
mode anymore, since currently Parser::addProjectTree() and
Parser::addFlatTree() are identical. For now, we just
remove this duplication. The subproject mode to be fixed later.
Amends 8634aa4cbd
Change-Id: I53d1b5a7354295449c2995c4421f8fa21a3ac2be
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
clearCache() is already called from inside
Manager::resetParser() ->
Parser::resetDataToCurrentState() ->
Parser::resetData() ->
Parser::clearCache().
Change-Id: I270be85b291f99552959e50ee54bd6e1f293c63a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Allow for direct connections where signal emitter and
receiver live in the same thread.
Remove unneeded mutexState, as changes to state and
all queries of state are done in the same thread.
Remove some indirections by removing some signals
and by calling respective slots through
QMetaObject::invokeMethod() or directly.
Remove some unused methods.
Remove a code path of setState(false), as this was never called.
Remove an initial call to onProjectListChanged(), as initially
the state is false and a call is no-op.
This change doesn't influence the existing behavior.
Task-number: QTCREATORBUG-25317
Change-Id: I683525b49afaf04e155d1859bb85ee5dd8e26dd2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
After you load the project, and after "Parsing C/C++ Files"
has finished, if you open the Class View and start
typing in cpp editor, a warning appears:
"QObject::killTimer: Timers cannot be stopped from another thread"
and changes to source files, like adding a new method or
renaming it, are not reflected anymore in Class View.
Short:
A fix is to give timer a parent in order to move it properly
into another thread.
Long:
Just after creating a Parser object we move it into another
thread by calling moveToThread(), inside constructor of
Manager in classviewmanager.cpp. All the children
of the moved object are moved together into the target thread.
Original intention of the timer object inside Parser was
that it should live in the same thread as its parent
Parser object. In meantime, after some refactoring,
that's not the case anymore and the timer is orphaned
(parentless in terms of QObject hierarchy). It means
it's not moved together with the parent Parser anymore,
while still being a member field of the Parser.
This is reflected in a warning message and class view
doesn't react to the changes in edited document anymore.
Amends 87b3ea9af4
Change-Id: I9cca7556d5b77aa31ce7b4ab426f84a478488a84
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
It's regularly getting in my way, and it's rather a namespace anyway.
Also, move the functions that are only used once closer to their
place of use.
Change-Id: I97951aae1b69c04f391afbdd1b491a8a9173a977
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
The document is used to do file watching, which may or may not be
ideal. So make sure we do not leak the information how we watch
files into the API and its users.
The method is not used sensibly anywhere in creator, so it seems
safe to remove it entirely.
Change-Id: Ieed755bd5c852875378e4e96665dc906499975b0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
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>
convertPosition change was introduced in 931ec39f64.
It changed 0-based column to 1-based which is how it
naturally is in Qt Creator.
This fixed some usages but broke many more. This is an
attempt to fix the remaining use cases.
Fixes CppEditor auto-tests.
Change-Id: Ia8d14da0ebb035cd2fdd6da4ff6ec89c1c5121a8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Use functionality available on Project if possible, thus preventing a crash
when trying to work with the rootProjectNode.
Task-number: QTCREATORBUG-17977
Change-Id: I397bbf501dc42b306ca88a67a3b2a0c9a9334d92
Reviewed-by: hjk <hjk@qt.io>
Clean up methods around projects() and update its usages to modern
language standards.
Change-Id: Ia0a4574d014ce41e0d511a392e4eed4680981d0e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Less code, and avoiding the need to have the temporary
file and folder node lists.
Change-Id: I65e1a7ec022b61f94b01e1e8476bb932d22fd161
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Use a class enum with a type quint16 for the NodeType. Frees 2 bytes
per node that can be used for better things now.
Change-Id: Ib84bf8629e9f4a5fb0793355eff0f0d6302167dd
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
We want to distinguish between source files and generated files. So
let's call them by their names.
Change-Id: I324c4b82ca7fb7d8d0e175ea6c4f14f1306ec929
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This avoids unnecessary detaches of the Qt container data.
The mismatches where detected by defining QT_STRICT_ITERATORS;
however, this define violates the ODR (causing linker errors),
and therefore is not added permanently.
Change-Id: Idd336a9c8b394214a820437ef1b92d2101f6101c
GPush-Base: 62b0848b9c
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
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: I6fbe13ddc1485efe95c3156097bf41d90c0febac
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
... by keying on Utils::FileName
Task-number: QTCREATORBUG-12390
Change-Id: Ia98afb5a9160a7fd9225a2f9e02539ff3c35ae86
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Replace the CppModelManagerInterface/derived CppModelManager
combo by a more common CppModelManager/CppModelManagerPrivate
pimpl pattern.
Change-Id: Ia4582845ed94d5ef60b8571bab9b2260c6290287
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This will hopefully help a bit in resolving the crashes that happen in
QCoreApplication::notifyInternal.
Change-Id: Ib3aa8c1a1f50778bd89938d7c529d8399ccf91ea
Task-number: QTCREATORBUG-11262
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Improved lazy loading mechanism. The main problem here was that
fetchMore function creates children items not only for selected
item but also for children items.
When one changed something in code then whole treeview was rebuilt
(and fetchMore function was called).
Replaced using "contains" and operator[] with 'value'.
Task-number: QTCREATORBUG-8813
Task-number: QTCREATORBUG-8801(partially)
Change-Id: If1ab69a0a67ff828275176ad99c3c63d2a1fa4a2
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Use it instead of retrieving this information from the document.
Change-Id: I809fcb2daf59021cf503c371a5d40d75d7448796
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
That is what it actually is, wrt how Qt API calls it.
Change-Id: Ied02055debf6aad75556b0d9d22e8ba2f72be555
Reviewed-by: Eike Ziller <eike.ziller@digia.com>