CMake: Move notification on outside cmake runs into FileApiReader

Move the detection of outside cmake runs into FileApiReader and
make the FileApiParser non-interactive.

Change-Id: I70afc1df35fcfe90e88822569579154aabbdb1cd
Fixes: QTCREATORBUG-24015
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Tobias Hunger
2020-05-13 12:59:23 +02:00
parent 517cb05db0
commit 7c985c14ad
4 changed files with 42 additions and 61 deletions

View File

@@ -814,18 +814,6 @@ QString FileApiDetails::ReplyFileContents::jsonFile(const QString &kind, const Q
// FileApi:
// --------------------------------------------------------------------
FileApiParser::FileApiParser(const FilePath &buildDirectory) : m_buildDirectory(buildDirectory)
{
setupCMakeFileApi(buildDirectory, m_watcher);
QObject::connect(&m_watcher,
&FileSystemWatcher::directoryChanged,
this,
&FileApiParser::replyDirectoryHasChanged);
}
FileApiParser::~FileApiParser() = default;
bool FileApiParser::setupCMakeFileApi(const FilePath &buildDirectory, Utils::FileSystemWatcher &watcher)
{
const QDir buildDir = QDir(buildDirectory.toString());
@@ -928,20 +916,5 @@ QStringList FileApiParser::cmakeQueryFilePaths(const Utils::FilePath &buildDirec
[&queryDir](const QString &name) { return queryDir.absoluteFilePath(name); });
}
void FileApiParser::setParsedReplyFilePath(const QString &filePath)
{
m_lastParsedReplyFile = filePath;
}
void FileApiParser::replyDirectoryHasChanged(const QString &directory) const
{
if (directory == cmakeReplyDirectory(m_buildDirectory).toString()) {
QFileInfo fi = scanForCMakeReplyFile(m_buildDirectory);
if (fi.isFile() && fi.filePath() != m_lastParsedReplyFile) {
emit dirty();
}
}
}
} // namespace Internal
} // namespace CMakeProjectManager