forked from qt-creator/qt-creator
Clang: Track visibility timepoint of documents
This enables determination of "most recenlty used" documents, which is needed for a follow-up change. Change-Id: I7b2c9001fd00173044983780e99817b4416e280e Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -71,6 +71,8 @@ public:
|
||||
|
||||
uint documentRevision = 0;
|
||||
|
||||
TimePoint visibleTimePoint;
|
||||
|
||||
TimePoint isDirtyChangeTimePoint;
|
||||
bool isDirty = false;
|
||||
|
||||
@@ -245,13 +247,22 @@ bool Document::isVisibleInEditor() const
|
||||
return d->isVisibleInEditor;
|
||||
}
|
||||
|
||||
void Document::setIsVisibleInEditor(bool isVisibleInEditor)
|
||||
void Document::setIsVisibleInEditor(bool isVisibleInEditor, const TimePoint &timePoint)
|
||||
{
|
||||
checkIfNull();
|
||||
|
||||
if (isVisibleInEditor)
|
||||
d->visibleTimePoint = timePoint;
|
||||
d->isVisibleInEditor = isVisibleInEditor;
|
||||
}
|
||||
|
||||
TimePoint Document::visibleTimePoint() const
|
||||
{
|
||||
checkIfNull();
|
||||
|
||||
return d->visibleTimePoint;;
|
||||
}
|
||||
|
||||
bool Document::isDirty() const
|
||||
{
|
||||
checkIfNull();
|
||||
|
||||
@@ -97,7 +97,8 @@ public:
|
||||
void setIsUsedByCurrentEditor(bool isUsedByCurrentEditor);
|
||||
|
||||
bool isVisibleInEditor() const;
|
||||
void setIsVisibleInEditor(bool isVisibleInEditor);
|
||||
void setIsVisibleInEditor(bool isVisibleInEditor, const TimePoint &timePoint);
|
||||
TimePoint visibleTimePoint() const;
|
||||
|
||||
bool isDirty() const;
|
||||
TimePoint isDirtyTimeChangePoint() const;
|
||||
|
||||
@@ -117,8 +117,9 @@ void Documents::setUsedByCurrentEditor(const Utf8String &filePath)
|
||||
|
||||
void Documents::setVisibleInEditors(const Utf8StringVector &filePaths)
|
||||
{
|
||||
const TimePoint timePoint = Clock::now();
|
||||
for (Document &document : documents_)
|
||||
document.setIsVisibleInEditor(filePaths.contains(document.filePath()));
|
||||
document.setIsVisibleInEditor(filePaths.contains(document.filePath()), timePoint);
|
||||
}
|
||||
|
||||
const Document &Documents::document(const Utf8String &filePath, const Utf8String &projectPartId) const
|
||||
|
||||
Reference in New Issue
Block a user