logic: Added indexing mode to reindex incomplete files (issue #493, #496)

* added radio buttons to start indexing dialog
* don't block task scheduler thread while start indexing dialog is visible
* don't force whole project refresh on settings change
* added help button to start indexing dialog explaining indexing modes
* disable unavailable modes when project needs full refresh
* improved label texts on indexing dialogs
* added --incomplete flag to index command of commandline API
* fixed deletion of window stack elements
This commit is contained in:
Eberhard Graether
2017-12-03 22:30:09 +01:00
parent faf9e7655f
commit f9e4afda77
33 changed files with 748 additions and 529 deletions
+42 -25
View File
@@ -345,29 +345,46 @@ void PersistentStorage::clearFileElements(const std::vector<FilePath>& filePaths
}
}
std::vector<FileInfo> PersistentStorage::getInfoOnAllFiles() const
std::vector<FileInfo> PersistentStorage::getFileInfoForAllFiles() const
{
TRACE();
std::vector<FileInfo> fileInfos;
std::vector<StorageFile> storageFiles = m_sqliteIndexStorage.getAll<StorageFile>();
for (size_t i = 0; i < storageFiles.size(); i++)
for (StorageFile file : m_sqliteIndexStorage.getAll<StorageFile>())
{
boost::posix_time::ptime modificationTime = boost::posix_time::not_a_date_time;
if (storageFiles[i].modificationTime != "not-a-date-time")
if (file.modificationTime != "not-a-date-time")
{
modificationTime = boost::posix_time::time_from_string(storageFiles[i].modificationTime);
modificationTime = boost::posix_time::time_from_string(file.modificationTime);
}
fileInfos.push_back(FileInfo(
FilePath(storageFiles[i].filePath),
modificationTime
));
fileInfos.push_back(
FileInfo(
FilePath(file.filePath),
modificationTime
)
);
}
return fileInfos;
}
std::set<FilePath> PersistentStorage::getIncompleteFiles() const
{
TRACE();
std::set<FilePath> incompleteFiles;
for (auto p : m_fileNodeComplete)
{
if (p.second == false)
{
incompleteFiles.insert(getFileNodePath(p.first));
}
}
return incompleteFiles;
}
void PersistentStorage::buildCaches()
{
TRACE();
@@ -1712,14 +1729,7 @@ TooltipInfo PersistentStorage::getTooltipInfoForTokenIds(const std::vector<Id>&
if (type.getType() == NodeType::NODE_FILE && m_fileNodePaths.find(node.id) != m_fileNodePaths.end())
{
bool complete = false;
auto it = m_fileNodeComplete.find(node.id);
if (it != m_fileNodeComplete.end())
{
complete = it->second;
}
if (!complete)
if (!getFileNodeComplete(node.id))
{
info.title = "incomplete " + info.title;
}
@@ -1960,16 +1970,23 @@ FilePath PersistentStorage::getFileNodePath(Id fileId) const
return FilePath();
}
bool PersistentStorage::getFileNodeComplete(const FilePath& filePath) const
bool PersistentStorage::getFilePathComplete(const FilePath& filePath) const
{
auto it = m_fileNodeIds.find(filePath);
if (it != m_fileNodeIds.end())
{
auto it2 = m_fileNodeComplete.find(it->second);
if (it2 != m_fileNodeComplete.end())
{
return it2->second;
}
return getFileNodeComplete(it->second);
}
return false;
}
bool PersistentStorage::getFileNodeComplete(Id fileId) const
{
auto it = m_fileNodeComplete.find(fileId);
if (it != m_fileNodeComplete.end())
{
return it->second;
}
return false;
@@ -2419,7 +2436,7 @@ void PersistentStorage::addCompleteFlagsToSourceLocationCollection(SourceLocatio
collection->forEachSourceLocationFile(
[this](std::shared_ptr<SourceLocationFile> file)
{
file->setIsComplete(getFileNodeComplete(file->getFilePath()));
file->setIsComplete(getFilePathComplete(file->getFilePath()));
}
);
}
+4 -2
View File
@@ -63,7 +63,8 @@ public:
void clearFileElements(const std::vector<FilePath>& filePaths, std::function<void(int)> updateStatusCallback);
std::vector<FileInfo> getInfoOnAllFiles() const;
std::vector<FileInfo> getFileInfoForAllFiles() const;
std::set<FilePath> getIncompleteFiles() const;
void buildCaches();
@@ -148,7 +149,8 @@ private:
std::vector<Id> getFileNodeIds(const std::vector<FilePath>& filePaths) const;
std::set<Id> getFileNodeIds(const std::set<FilePath>& filePaths) const;
FilePath getFileNodePath(Id fileId) const;
bool getFileNodeComplete(const FilePath& filePath) const;
bool getFilePathComplete(const FilePath& filePath) const;
bool getFileNodeComplete(Id fileId) const;
std::unordered_map<Id, std::set<Id>> getFileIdToIncludingFileIdMap() const;
std::unordered_map<Id, std::set<Id>> getFileIdToImportingFileIdMap() const;