logic: record and display include edges for non-indexed files
* non-indexed files are shown in graph view and in code view * non-indexed files are ignored in search view, overview, stats and refresh dialog
This commit is contained in:
@@ -301,6 +301,11 @@ void QtCodeFile::setIsComplete(bool isComplete)
|
||||
m_titleBar->setIsComplete(isComplete);
|
||||
}
|
||||
|
||||
void QtCodeFile::setIsIndexed(bool isIndexed)
|
||||
{
|
||||
m_titleBar->setIsIndexed(isIndexed);
|
||||
}
|
||||
|
||||
void QtCodeFile::setMinimized()
|
||||
{
|
||||
for (QtCodeSnippet* snippet : m_snippets)
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
|
||||
void setWholeFile(bool isWholeFile, int refCount);
|
||||
void setIsComplete(bool isComplete);
|
||||
void setIsIndexed(bool isIndexed);
|
||||
|
||||
void setMinimized();
|
||||
void setSnippets();
|
||||
|
||||
@@ -117,12 +117,13 @@ QtCodeFile* QtCodeFileList::getFile(const FilePath filePath)
|
||||
return file;
|
||||
}
|
||||
|
||||
void QtCodeFileList::addFile(const FilePath& filePath, bool isWholeFile, int refCount, TimeStamp modificationTime, bool isComplete)
|
||||
void QtCodeFileList::addFile(std::shared_ptr<SourceLocationFile> locationFile, int refCount, TimeStamp modificationTime)
|
||||
{
|
||||
QtCodeFile* file = getFile(filePath);
|
||||
file->setWholeFile(isWholeFile, refCount);
|
||||
QtCodeFile* file = getFile(locationFile->getFilePath());
|
||||
file->setWholeFile(locationFile->isWhole(), refCount);
|
||||
file->setModificationTime(modificationTime);
|
||||
file->setIsComplete(isComplete);
|
||||
file->setIsComplete(locationFile->isComplete());
|
||||
file->setIsIndexed(locationFile->isIndexed());
|
||||
}
|
||||
|
||||
QScrollArea* QtCodeFileList::getScrollArea()
|
||||
@@ -145,6 +146,7 @@ void QtCodeFileList::addCodeSnippet(const CodeSnippetParams& params)
|
||||
|
||||
file->setModificationTime(params.modificationTime);
|
||||
file->setIsComplete(params.locationFile->isComplete());
|
||||
file->setIsIndexed(params.locationFile->isIndexed());
|
||||
}
|
||||
|
||||
void QtCodeFileList::updateCodeSnippet(const CodeSnippetParams& params)
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
void clearSnippetTitleAndScrollBar();
|
||||
|
||||
QtCodeFile* getFile(const FilePath filePath);
|
||||
void addFile(const FilePath& filePath, bool isWholeFile, int refCount, TimeStamp modificationTime, bool isComplete);
|
||||
void addFile(std::shared_ptr<SourceLocationFile> locationFile, int refCount, TimeStamp modificationTime);
|
||||
|
||||
// QtCodeNaviatebale implementation
|
||||
virtual QScrollArea* getScrollArea();
|
||||
|
||||
@@ -89,6 +89,7 @@ void QtCodeFileSingle::addCodeSnippet(const CodeSnippetParams& params)
|
||||
file.filePath = params.locationFile->getFilePath();
|
||||
file.modificationTime = params.modificationTime;
|
||||
file.isComplete = params.locationFile->isComplete();
|
||||
file.isIndexed = params.locationFile->isIndexed();
|
||||
|
||||
if (params.reduced)
|
||||
{
|
||||
@@ -327,12 +328,14 @@ void QtCodeFileSingle::setFileData(const FileData& file)
|
||||
{
|
||||
titleButton->setProject(file.title);
|
||||
m_titleBar->setIsComplete(true);
|
||||
m_titleBar->setIsIndexed(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
titleButton->setFilePath(file.filePath);
|
||||
titleButton->setModificationTime(file.modificationTime);
|
||||
m_titleBar->setIsComplete(file.isComplete);
|
||||
m_titleBar->setIsIndexed(file.isIndexed);
|
||||
}
|
||||
|
||||
updateRefCount(m_area->getActiveLocationCount());
|
||||
|
||||
@@ -62,6 +62,7 @@ private:
|
||||
FilePath filePath;
|
||||
TimeStamp modificationTime;
|
||||
bool isComplete = false;
|
||||
bool isIndexed = false;
|
||||
std::wstring title;
|
||||
|
||||
QtCodeArea* area = nullptr;
|
||||
|
||||
@@ -115,6 +115,11 @@ void QtCodeFileTitleBar::setIsComplete(bool isComplete)
|
||||
m_showErrorsButton->setVisible(!isComplete);
|
||||
}
|
||||
|
||||
void QtCodeFileTitleBar::setIsIndexed(bool isIndexed)
|
||||
{
|
||||
m_titleButton->setIsIndexed(isIndexed);
|
||||
}
|
||||
|
||||
void QtCodeFileTitleBar::updateRefCount(int refCount, bool hasErrors, size_t fatalErrorCount)
|
||||
{
|
||||
if (refCount > 0)
|
||||
|
||||
@@ -24,6 +24,7 @@ public:
|
||||
QtCodeFileTitleButton* getTitleButton() const;
|
||||
|
||||
void setIsComplete(bool isComplete);
|
||||
void setIsIndexed(bool isIndexed);
|
||||
void updateRefCount(int refCount, bool hasErrors, size_t fatalErrorCount);
|
||||
|
||||
void setMinimized();
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
QtCodeFileTitleButton::QtCodeFileTitleButton(QWidget* parent)
|
||||
: QtSelfRefreshIconButton("", FilePath(), "code/file/title", parent)
|
||||
, m_isComplete(true)
|
||||
, m_isIndexed(true)
|
||||
{
|
||||
setObjectName("title_button");
|
||||
minimumSizeHint(); // force font loading
|
||||
@@ -39,12 +40,9 @@ void QtCodeFileTitleButton::setFilePath(const FilePath& filePath)
|
||||
{
|
||||
setEnabled(true);
|
||||
|
||||
if (m_filePath.empty())
|
||||
{
|
||||
setIconPath(ResourcePaths::getGuiPath().concatenate(L"code_view/images/file.png"));
|
||||
}
|
||||
|
||||
m_filePath = filePath;
|
||||
|
||||
updateIcon();
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::setModificationTime(const TimeStamp modificationTime)
|
||||
@@ -62,7 +60,7 @@ void QtCodeFileTitleButton::setProject(const std::wstring& name)
|
||||
setText(QString::fromStdWString(name));
|
||||
setToolTip("edit project");
|
||||
|
||||
setIconPath(ResourcePaths::getGuiPath().concatenate(L"code_view/images/edit.png"));
|
||||
updateIcon();
|
||||
}
|
||||
|
||||
bool QtCodeFileTitleButton::isComplete() const
|
||||
@@ -80,6 +78,24 @@ void QtCodeFileTitleButton::setIsComplete(bool isComplete)
|
||||
m_isComplete = isComplete;
|
||||
setProperty("complete", isComplete);
|
||||
|
||||
updateIcon();
|
||||
}
|
||||
|
||||
bool QtCodeFileTitleButton::isIndexed() const
|
||||
{
|
||||
return m_isIndexed;
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::setIsIndexed(bool isIndexed)
|
||||
{
|
||||
if (m_isIndexed == isIndexed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_isIndexed = isIndexed;
|
||||
setProperty("nonindexed", !isIndexed);
|
||||
|
||||
updateHatching();
|
||||
}
|
||||
|
||||
@@ -93,11 +109,9 @@ void QtCodeFileTitleButton::updateTexts()
|
||||
std::wstring title = m_filePath.fileName();
|
||||
std::wstring toolTip = L"file: " + m_filePath.wstr();
|
||||
|
||||
if ((!m_filePath.recheckExists()) ||
|
||||
(FileSystem::getLastWriteTime(m_filePath) > m_modificationTime))
|
||||
if (!m_isIndexed)
|
||||
{
|
||||
title += L"*";
|
||||
toolTip = L"out of date " + toolTip;
|
||||
toolTip = L"non-indexed " + toolTip;
|
||||
}
|
||||
|
||||
if (!m_isComplete)
|
||||
@@ -105,6 +119,13 @@ void QtCodeFileTitleButton::updateTexts()
|
||||
toolTip = L"incomplete " + toolTip;
|
||||
}
|
||||
|
||||
if ((!m_filePath.recheckExists()) ||
|
||||
(FileSystem::getLastWriteTime(m_filePath) > m_modificationTime))
|
||||
{
|
||||
title += L"*";
|
||||
toolTip = L"out-of-date " + toolTip;
|
||||
}
|
||||
|
||||
setText(QString::fromStdWString(title));
|
||||
setToolTip(QString::fromStdWString(toolTip));
|
||||
}
|
||||
@@ -122,6 +143,7 @@ void QtCodeFileTitleButton::updateFromOther(const QtCodeFileTitleButton* other)
|
||||
|
||||
setModificationTime(other->m_modificationTime);
|
||||
setIsComplete(other->m_isComplete);
|
||||
setIsIndexed(other->m_isIndexed);
|
||||
updateTexts();
|
||||
}
|
||||
|
||||
@@ -164,9 +186,25 @@ void QtCodeFileTitleButton::clickedTitle()
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::updateIcon()
|
||||
{
|
||||
if (m_filePath.empty())
|
||||
{
|
||||
setIconPath(ResourcePaths::getGuiPath().concatenate(L"code_view/images/edit.png"));
|
||||
}
|
||||
else if (!m_isComplete)
|
||||
{
|
||||
setIconPath(ResourcePaths::getGuiPath().concatenate(L"graph_view/images/file_incomplete.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
setIconPath(ResourcePaths::getGuiPath().concatenate(L"code_view/images/file.png"));
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::updateHatching()
|
||||
{
|
||||
if (!m_isComplete)
|
||||
if (!m_isIndexed)
|
||||
{
|
||||
FilePath hatchingFilePath = ResourcePaths::getGuiPath().concatenate(L"code_view/images/pattern_" +
|
||||
utility::decodeFromUtf8(ColorScheme::getInstance()->getColor("code/file/title/hatching")) + L".png"
|
||||
|
||||
@@ -24,6 +24,9 @@ public:
|
||||
bool isComplete() const;
|
||||
void setIsComplete(bool isComplete);
|
||||
|
||||
bool isIndexed() const;
|
||||
void setIsIndexed(bool isIndexed);
|
||||
|
||||
void updateTexts();
|
||||
void updateFromOther(const QtCodeFileTitleButton* other);
|
||||
|
||||
@@ -36,11 +39,13 @@ private slots:
|
||||
void clickedTitle();
|
||||
|
||||
private:
|
||||
void updateIcon();
|
||||
void updateHatching();
|
||||
|
||||
FilePath m_filePath;
|
||||
TimeStamp m_modificationTime;
|
||||
bool m_isComplete;
|
||||
bool m_isIndexed;
|
||||
};
|
||||
|
||||
#endif // QT_CODE_FILE_TITLE_BUTTON_H
|
||||
|
||||
@@ -148,7 +148,7 @@ void QtCodeNavigator::updateCodeSnippet(const CodeSnippetParams& params)
|
||||
|
||||
void QtCodeNavigator::addFile(std::shared_ptr<SourceLocationFile> locationFile, int refCount, TimeStamp modificationTime)
|
||||
{
|
||||
m_list->addFile(locationFile->getFilePath(), locationFile->isWhole(), refCount, modificationTime, locationFile->isComplete());
|
||||
m_list->addFile(locationFile, refCount, modificationTime);
|
||||
|
||||
if (locationFile->isWhole())
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ QtCodeSnippet* QtCodeSnippet::merged(
|
||||
SourceLocationFile* bFile = b->m_codeArea->getSourceLocationFile().get();
|
||||
|
||||
std::shared_ptr<SourceLocationFile> locationFile =
|
||||
std::make_shared<SourceLocationFile>(aFile->getFilePath(), aFile->isWhole(), aFile->isWhole());
|
||||
std::make_shared<SourceLocationFile>(aFile->getFilePath(), aFile->isWhole(), aFile->isComplete(), aFile->isIndexed());
|
||||
|
||||
aFile->forEachSourceLocation(
|
||||
[&locationFile](SourceLocation* loc)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "utility/messaging/type/MessageDeactivateEdge.h"
|
||||
#include "utility/messaging/type/MessageFocusIn.h"
|
||||
#include "utility/messaging/type/MessageFocusOut.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
|
||||
#include "data/graph/token_component/TokenComponentFilePath.h"
|
||||
|
||||
@@ -28,9 +29,10 @@ const Node* QtGraphNodeData::getData() const
|
||||
|
||||
FilePath QtGraphNodeData::getFilePath() const
|
||||
{
|
||||
if (m_data->getType().isFile())
|
||||
TokenComponentFilePath* component = m_data->getComponent<TokenComponentFilePath>();
|
||||
if (component)
|
||||
{
|
||||
return m_data->getComponent<TokenComponentFilePath>()->getFilePath();
|
||||
return component->getFilePath();
|
||||
}
|
||||
|
||||
return FilePath();
|
||||
@@ -61,6 +63,13 @@ void QtGraphNodeData::updateStyle()
|
||||
{
|
||||
GraphViewStyle::NodeStyle style = GraphViewStyle::getStyleForNodeType(
|
||||
m_data->getType(), m_data->isExplicit(), m_isActive, m_isHovering, m_childVisible, m_hasQualifier);
|
||||
|
||||
TokenComponentFilePath* component = m_data->getComponent<TokenComponentFilePath>();
|
||||
if (component && !component->isComplete())
|
||||
{
|
||||
style.iconPath = ResourcePaths::getGuiPath().concatenate(L"graph_view/images/file_incomplete.png");
|
||||
}
|
||||
|
||||
setStyle(style);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user