ui: implemented prefilling indexed header paths for compilation database projects
* fixed header path detection in CompilationDatabase class
This commit is contained in:
@@ -508,6 +508,8 @@ add_files(
|
|||||||
utility/UserPaths.h
|
utility/UserPaths.h
|
||||||
utility/utility.cpp
|
utility/utility.cpp
|
||||||
utility/utility.h
|
utility/utility.h
|
||||||
|
utility/utilityFile.cpp
|
||||||
|
utility/utilityFile.h
|
||||||
utility/utilityLibrary.h
|
utility/utilityLibrary.h
|
||||||
utility/utilityString.cpp
|
utility/utilityString.cpp
|
||||||
utility/utilityString.h
|
utility/utilityString.h
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ std::string ProjectSettings::getProjectName() const
|
|||||||
return getFilePath().withoutExtension().fileName();
|
return getFilePath().withoutExtension().fileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath ProjectSettings::getProjectFileLocation() const
|
FilePath ProjectSettings::getProjectDirectoryPath() const
|
||||||
{
|
{
|
||||||
return getFilePath().parentDirectory();
|
return getFilePath().parentDirectory();
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ std::vector<FilePath> ProjectSettings::makePathsExpandedAndAbsolute(const std::v
|
|||||||
std::vector<FilePath> p = expandPaths(paths);
|
std::vector<FilePath> p = expandPaths(paths);
|
||||||
|
|
||||||
std::vector<FilePath> absPaths;
|
std::vector<FilePath> absPaths;
|
||||||
FilePath basePath = getProjectFileLocation();
|
FilePath basePath = getProjectDirectoryPath();
|
||||||
for (const FilePath& path : p)
|
for (const FilePath& path : p)
|
||||||
{
|
{
|
||||||
if (path.isAbsolute())
|
if (path.isAbsolute())
|
||||||
@@ -229,7 +229,7 @@ FilePath ProjectSettings::makePathExpandedAndAbsolute(const FilePath& path) cons
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getProjectFileLocation().concat(p).canonical();
|
return getProjectDirectoryPath().concat(p).canonical();
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsMigrator ProjectSettings::getMigrations() const
|
SettingsMigrator ProjectSettings::getMigrations() const
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public:
|
|||||||
void setProjectFilePath(std::string projectName, const FilePath& projectFileLocation);
|
void setProjectFilePath(std::string projectName, const FilePath& projectFileLocation);
|
||||||
|
|
||||||
std::string getProjectName() const;
|
std::string getProjectName() const;
|
||||||
FilePath getProjectFileLocation() const;
|
FilePath getProjectDirectoryPath() const;
|
||||||
|
|
||||||
std::string getDescription() const;
|
std::string getDescription() const;
|
||||||
|
|
||||||
|
|||||||
@@ -80,9 +80,9 @@ void SourceGroupSettings::setName(const std::string& name)
|
|||||||
m_name = name;
|
m_name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath SourceGroupSettings::getProjectFileLocation() const
|
FilePath SourceGroupSettings::getProjectDirectoryPath() const
|
||||||
{
|
{
|
||||||
return m_projectSettings->getProjectFileLocation();
|
return m_projectSettings->getProjectDirectoryPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath SourceGroupSettings::makePathExpandedAndAbsolute(const FilePath& path) const
|
FilePath SourceGroupSettings::makePathExpandedAndAbsolute(const FilePath& path) const
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public:
|
|||||||
std::string getName() const;
|
std::string getName() const;
|
||||||
void setName(const std::string& name);
|
void setName(const std::string& name);
|
||||||
|
|
||||||
FilePath getProjectFileLocation() const;
|
FilePath getProjectDirectoryPath() const;
|
||||||
FilePath makePathExpandedAndAbsolute(const FilePath& path) const;
|
FilePath makePathExpandedAndAbsolute(const FilePath& path) const;
|
||||||
std::vector<FilePath> makePathsExpandedAndAbsolute(const std::vector<FilePath>& paths) const;
|
std::vector<FilePath> makePathsExpandedAndAbsolute(const std::vector<FilePath>& paths) const;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#include "utility/utilityFile.h"
|
||||||
|
|
||||||
|
std::vector<FilePath> utility::getTopLevelPaths(const std::vector<FilePath>& paths)
|
||||||
|
{
|
||||||
|
std::vector<FilePath> topLevelPaths;
|
||||||
|
for (const FilePath& path : paths)
|
||||||
|
{
|
||||||
|
bool addPath = true;
|
||||||
|
for (size_t i = 0; i < topLevelPaths.size(); i++)
|
||||||
|
{
|
||||||
|
if (topLevelPaths[i].contains(path))
|
||||||
|
{
|
||||||
|
addPath = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if(path.contains(topLevelPaths[i]))
|
||||||
|
{
|
||||||
|
topLevelPaths.erase(topLevelPaths.begin() + i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (addPath)
|
||||||
|
{
|
||||||
|
topLevelPaths.push_back(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return topLevelPaths;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#ifndef UTILITY_FILE_H
|
||||||
|
#define UTILITY_FILE_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "utility/file/FilePath.h"
|
||||||
|
|
||||||
|
namespace utility
|
||||||
|
{
|
||||||
|
std::vector<FilePath> getTopLevelPaths(const std::vector<FilePath>& paths);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // UTILITY_FILE_H
|
||||||
@@ -5,15 +5,16 @@
|
|||||||
#include "clang/Tooling/JSONCompilationDatabase.h"
|
#include "clang/Tooling/JSONCompilationDatabase.h"
|
||||||
#include "clang/Tooling/CompilationDatabase.h"
|
#include "clang/Tooling/CompilationDatabase.h"
|
||||||
#include "utility/file/FilePath.h"
|
#include "utility/file/FilePath.h"
|
||||||
|
#include "utility/utilityString.h"
|
||||||
#include "utility/utility.h"
|
#include "utility/utility.h"
|
||||||
|
|
||||||
utility::CompilationDatabase::CompilationDatabase(std::string filename)
|
utility::CompilationDatabase::CompilationDatabase(const FilePath& filePath)
|
||||||
: m_filename(filename)
|
: m_filePath(filePath)
|
||||||
{
|
{
|
||||||
getHeaders();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<FilePath> utility::CompilationDatabase::getAllHeaderPaths()
|
std::vector<FilePath> utility::CompilationDatabase::getAllHeaderPaths() const
|
||||||
{
|
{
|
||||||
std::vector<FilePath> paths = utility::concat(m_headers, m_systemHeaders);
|
std::vector<FilePath> paths = utility::concat(m_headers, m_systemHeaders);
|
||||||
paths = utility::concat(paths, m_frameworkHeaders);
|
paths = utility::concat(paths, m_frameworkHeaders);
|
||||||
@@ -21,47 +22,64 @@ std::vector<FilePath> utility::CompilationDatabase::getAllHeaderPaths()
|
|||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<FilePath> utility::CompilationDatabase::getHeaderPaths()
|
std::vector<FilePath> utility::CompilationDatabase::getHeaderPaths() const
|
||||||
{
|
{
|
||||||
return m_headers;
|
return m_headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<FilePath> utility::CompilationDatabase::getSystemHeaderPaths()
|
std::vector<FilePath> utility::CompilationDatabase::getSystemHeaderPaths() const
|
||||||
{
|
{
|
||||||
return m_systemHeaders;
|
return m_systemHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<FilePath> utility::CompilationDatabase::getFrameworkHeaderPaths()
|
std::vector<FilePath> utility::CompilationDatabase::getFrameworkHeaderPaths() const
|
||||||
{
|
{
|
||||||
return m_frameworkHeaders;
|
return m_frameworkHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
void utility::CompilationDatabase::getHeaders()
|
void utility::CompilationDatabase::init()
|
||||||
{
|
{
|
||||||
std::string error;
|
std::string error;
|
||||||
std::shared_ptr<clang::tooling::JSONCompilationDatabase> cdb = std::shared_ptr<clang::tooling::JSONCompilationDatabase>
|
std::shared_ptr<clang::tooling::JSONCompilationDatabase> cdb = std::shared_ptr<clang::tooling::JSONCompilationDatabase>(
|
||||||
(clang::tooling::JSONCompilationDatabase::loadFromFile(m_filename, error, clang::tooling::JSONCommandLineSyntax::AutoDetect));
|
clang::tooling::JSONCompilationDatabase::loadFromFile(m_filePath.str(), error, clang::tooling::JSONCommandLineSyntax::AutoDetect)
|
||||||
|
);
|
||||||
|
|
||||||
std::vector<clang::tooling::CompileCommand> commands = cdb->getAllCompileCommands();
|
std::vector<clang::tooling::CompileCommand> commands = cdb->getAllCompileCommands();
|
||||||
std::set<FilePath> frameworkHeaders;
|
std::set<FilePath> frameworkHeaders;
|
||||||
std::set<FilePath> systemHeaders;
|
std::set<FilePath> systemHeaders;
|
||||||
std::set<FilePath> headers;
|
std::set<FilePath> headers;
|
||||||
|
|
||||||
for (clang::tooling::CompileCommand& command : commands)
|
|
||||||
{
|
{
|
||||||
for( size_t i = 0; i < command.CommandLine.size(); i++)
|
const std::string frameworkIncludeFlag = "-iframework";
|
||||||
|
const std::string systemIncludeFlag = "-isystem";
|
||||||
|
const std::string quoteFlag = "-iquote";
|
||||||
|
const std::string includeFlag = "-I";
|
||||||
|
for (clang::tooling::CompileCommand& command : commands)
|
||||||
{
|
{
|
||||||
if( command.CommandLine[i] == "-iframework" )
|
for (size_t i = 0; i < command.CommandLine.size(); i++)
|
||||||
{
|
{
|
||||||
frameworkHeaders.insert(FilePath(command.CommandLine[++i], command.Directory));
|
std::string argument = command.CommandLine[i];
|
||||||
}
|
if (!utility::isPrefix("-", command.CommandLine[i + 1]))
|
||||||
if( command.CommandLine[i] == "-isystem" )
|
{
|
||||||
{
|
argument += command.CommandLine[++i];
|
||||||
systemHeaders.insert(FilePath(command.CommandLine[++i], command.Directory));
|
}
|
||||||
}
|
|
||||||
if( command.CommandLine[i].substr(0,2) == "-I" )
|
if (utility::isPrefix(frameworkIncludeFlag, argument))
|
||||||
{
|
{
|
||||||
headers.insert(FilePath(command.CommandLine[i].substr(2), command.Directory));
|
frameworkHeaders.insert(FilePath(utility::trim(argument.substr(frameworkIncludeFlag.size())), command.Directory));
|
||||||
|
}
|
||||||
|
else if (utility::isPrefix(systemIncludeFlag, argument))
|
||||||
|
{
|
||||||
|
systemHeaders.insert(FilePath(utility::trim(argument.substr(systemIncludeFlag.size())), command.Directory));
|
||||||
|
}
|
||||||
|
else if (utility::isPrefix(quoteFlag, argument))
|
||||||
|
{
|
||||||
|
headers.insert(FilePath(utility::trim(argument.substr(quoteFlag.size())), command.Directory));
|
||||||
|
}
|
||||||
|
else if (utility::isPrefix(includeFlag, argument))
|
||||||
|
{
|
||||||
|
headers.insert(FilePath(utility::trim(argument.substr(includeFlag.size())), command.Directory));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,27 +4,27 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class FilePath;
|
#include "utility/file/FilePath.h"
|
||||||
|
|
||||||
namespace utility
|
namespace utility
|
||||||
{
|
{
|
||||||
class CompilationDatabase
|
class CompilationDatabase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CompilationDatabase(std::string filename);
|
CompilationDatabase(const FilePath& filePath);
|
||||||
|
|
||||||
std::vector<FilePath> getAllHeaderPaths();
|
std::vector<FilePath> getAllHeaderPaths() const;
|
||||||
std::vector<FilePath> getHeaderPaths();
|
std::vector<FilePath> getHeaderPaths() const;
|
||||||
std::vector<FilePath> getSystemHeaderPaths();
|
std::vector<FilePath> getSystemHeaderPaths() const;
|
||||||
std::vector<FilePath> getFrameworkHeaderPaths();
|
std::vector<FilePath> getFrameworkHeaderPaths() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_filename;
|
void init();
|
||||||
|
|
||||||
|
FilePath m_filePath;
|
||||||
std::vector<FilePath> m_headers;
|
std::vector<FilePath> m_headers;
|
||||||
std::vector<FilePath> m_systemHeaders;
|
std::vector<FilePath> m_systemHeaders;
|
||||||
std::vector<FilePath> m_frameworkHeaders;
|
std::vector<FilePath> m_frameworkHeaders;
|
||||||
|
|
||||||
void getHeaders();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ void QtProjectWizzardContentCDBSource::load()
|
|||||||
{
|
{
|
||||||
m_fileNames.clear();
|
m_fileNames.clear();
|
||||||
|
|
||||||
const FilePath projectPath = m_settings->getProjectFileLocation();
|
const FilePath projectPath = m_settings->getProjectDirectoryPath();
|
||||||
std::vector<FilePath> excludePaths = m_settings->getExcludePathsExpandedAndAbsolute();
|
std::vector<FilePath> excludePaths = m_settings->getExcludePathsExpandedAndAbsolute();
|
||||||
|
|
||||||
if (std::shared_ptr<SourceGroupSettingsCxxCdb> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
|
if (std::shared_ptr<SourceGroupSettingsCxxCdb> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ void QtProjectWizzardContentPath::populate(QGridLayout* layout, int& row)
|
|||||||
|
|
||||||
if (m_makePathRelativeToProjectFileLocation)
|
if (m_makePathRelativeToProjectFileLocation)
|
||||||
{
|
{
|
||||||
m_picker->setRelativeRootDirectory(m_settings->getProjectFileLocation());
|
m_picker->setRelativeRootDirectory(m_settings->getProjectDirectoryPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
layout->addWidget(m_picker, row, QtProjectWizzardWindow::BACK_COL);
|
layout->addWidget(m_picker, row, QtProjectWizzardWindow::BACK_COL);
|
||||||
@@ -263,7 +263,7 @@ std::vector<std::string> QtProjectWizzardContentPathSourceMaven::getFileNames()
|
|||||||
m_settings->getSourceExtensions()
|
m_settings->getSourceExtensions()
|
||||||
);
|
);
|
||||||
|
|
||||||
const FilePath projectPath = m_settings->getProjectFileLocation();
|
const FilePath projectPath = m_settings->getProjectDirectoryPath();
|
||||||
|
|
||||||
for (FilePath path: fileManager.getAllSourceFilePaths())
|
for (FilePath path: fileManager.getAllSourceFilePaths())
|
||||||
{
|
{
|
||||||
@@ -394,7 +394,7 @@ std::vector<std::string> QtProjectWizzardContentPathSourceGradle::getFileNames()
|
|||||||
m_settings->getSourceExtensions()
|
m_settings->getSourceExtensions()
|
||||||
);
|
);
|
||||||
|
|
||||||
const FilePath projectPath = m_settings->getProjectFileLocation();
|
const FilePath projectPath = m_settings->getProjectDirectoryPath();
|
||||||
|
|
||||||
for (FilePath path : fileManager.getAllSourceFilePaths())
|
for (FilePath path : fileManager.getAllSourceFilePaths())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "utility/file/FileManager.h"
|
#include "utility/file/FileManager.h"
|
||||||
#include "utility/ScopedFunctor.h"
|
#include "utility/ScopedFunctor.h"
|
||||||
#include "utility/utility.h"
|
#include "utility/utility.h"
|
||||||
|
#include "utility/utilityFile.h"
|
||||||
#include "utility/utilityPathDetection.h"
|
#include "utility/utilityPathDetection.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
@@ -43,7 +44,7 @@ void QtProjectWizzardContentPaths::populate(QGridLayout* layout, int& row)
|
|||||||
|
|
||||||
if (m_makePathsRelativeToProjectFileLocation && m_settings)
|
if (m_makePathsRelativeToProjectFileLocation && m_settings)
|
||||||
{
|
{
|
||||||
m_list->setRelativeRootDirectory(m_settings->getProjectFileLocation());
|
m_list->setRelativeRootDirectory(m_settings->getProjectDirectoryPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
layout->addWidget(m_list, row, QtProjectWizzardWindow::BACK_COL);
|
layout->addWidget(m_list, row, QtProjectWizzardWindow::BACK_COL);
|
||||||
@@ -192,7 +193,7 @@ std::vector<std::string> QtProjectWizzardContentPathsSource::getFileNames() cons
|
|||||||
m_settings->getSourceExtensions()
|
m_settings->getSourceExtensions()
|
||||||
);
|
);
|
||||||
|
|
||||||
const std::set<FilePath> filePaths = fileManager.getAllSourceFilePathsRelative(m_settings->getProjectFileLocation());
|
const std::set<FilePath> filePaths = fileManager.getAllSourceFilePathsRelative(m_settings->getProjectDirectoryPath());
|
||||||
|
|
||||||
std::vector<std::string> list;
|
std::vector<std::string> list;
|
||||||
list.resize(filePaths.size());
|
list.resize(filePaths.size());
|
||||||
@@ -211,6 +212,22 @@ QString QtProjectWizzardContentPathsSource::getFileNamesDescription() const
|
|||||||
return " files will be indexed.";
|
return " files will be indexed.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<FilePath> QtProjectWizzardContentPathsCDBHeader::getTopLevelHeaderSearchPaths(
|
||||||
|
std::shared_ptr<SourceGroupSettingsCxxCdb> settings)
|
||||||
|
{
|
||||||
|
const FilePath cdbPath = settings->getCompilationDatabasePathExpandedAndAbsolute();
|
||||||
|
if (!cdbPath.exists())
|
||||||
|
{
|
||||||
|
LOG_WARNING("Unable to fetch top level header search directories. The provided Compilation Database path does not exist.");
|
||||||
|
return std::vector<FilePath>();
|
||||||
|
}
|
||||||
|
const std::vector<FilePath> sourcePaths = settings->getSourcePaths();
|
||||||
|
return utility::getTopLevelPaths(utility::unique(utility::concat(
|
||||||
|
sourcePaths, utility::CompilationDatabase(cdbPath).getAllHeaderPaths()
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
QtProjectWizzardContentPathsCDBHeader::QtProjectWizzardContentPathsCDBHeader(
|
QtProjectWizzardContentPathsCDBHeader::QtProjectWizzardContentPathsCDBHeader(
|
||||||
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
|
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
|
||||||
)
|
)
|
||||||
@@ -242,6 +259,25 @@ void QtProjectWizzardContentPathsCDBHeader::populate(QGridLayout* layout, int& r
|
|||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtProjectWizzardContentPathsCDBHeader::load()
|
||||||
|
{
|
||||||
|
if (m_settings->getSourcePaths().empty())
|
||||||
|
{
|
||||||
|
std::shared_ptr<SourceGroupSettingsCxxCdb> cdbSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings);
|
||||||
|
std::vector<FilePath> sourcePaths;
|
||||||
|
for (const FilePath& path : getTopLevelHeaderSearchPaths(cdbSettings))
|
||||||
|
{
|
||||||
|
if (path.exists() && m_settings->getProjectDirectoryPath().contains(path))
|
||||||
|
{
|
||||||
|
sourcePaths.push_back(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_settings->setSourcePaths(sourcePaths);
|
||||||
|
}
|
||||||
|
|
||||||
|
QtProjectWizzardContentPathsSource::load();
|
||||||
|
}
|
||||||
|
|
||||||
bool QtProjectWizzardContentPathsCDBHeader::check()
|
bool QtProjectWizzardContentPathsCDBHeader::check()
|
||||||
{
|
{
|
||||||
if (!m_list->getList().size())
|
if (!m_list->getList().size())
|
||||||
@@ -269,7 +305,7 @@ void QtProjectWizzardContentPathsCDBHeader::buttonClicked()
|
|||||||
|
|
||||||
if (!m_filesDialog)
|
if (!m_filesDialog)
|
||||||
{
|
{
|
||||||
FilePath cdbPath = dynamic_cast<SourceGroupSettingsCxxCdb*>(m_settings.get())->getCompilationDatabasePathExpandedAndAbsolute(); // TODO: remove this cast
|
const FilePath cdbPath = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings)->getCompilationDatabasePathExpandedAndAbsolute();
|
||||||
if (!cdbPath.exists())
|
if (!cdbPath.exists())
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
@@ -288,30 +324,10 @@ void QtProjectWizzardContentPathsCDBHeader::buttonClicked()
|
|||||||
connect(m_filesDialog.get(), &QtSelectPathsDialog::finished, this, &QtProjectWizzardContentPathsCDBHeader::savedFilesDialog);
|
connect(m_filesDialog.get(), &QtSelectPathsDialog::finished, this, &QtProjectWizzardContentPathsCDBHeader::savedFilesDialog);
|
||||||
connect(m_filesDialog.get(), &QtSelectPathsDialog::canceled, this, &QtProjectWizzardContentPathsCDBHeader::closedFilesDialog);
|
connect(m_filesDialog.get(), &QtSelectPathsDialog::canceled, this, &QtProjectWizzardContentPathsCDBHeader::closedFilesDialog);
|
||||||
|
|
||||||
|
dynamic_cast<QtSelectPathsDialog*>(m_filesDialog.get())->setPathsList(
|
||||||
utility::CompilationDatabase cdb(cdbPath.str());
|
getTopLevelHeaderSearchPaths(std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings)),
|
||||||
|
m_settings->getSourcePaths()
|
||||||
std::vector<FilePath> sourcePaths = m_settings->getSourcePaths();
|
);
|
||||||
|
|
||||||
std::vector<FilePath> cdbHeaderPaths;
|
|
||||||
for (const FilePath& path: utility::unique(utility::concat(sourcePaths, cdb.getAllHeaderPaths())))
|
|
||||||
{
|
|
||||||
bool addPath = true;
|
|
||||||
for (const FilePath& cdbHeaderPath: cdbHeaderPaths)
|
|
||||||
{
|
|
||||||
if (cdbHeaderPath.contains(path))
|
|
||||||
{
|
|
||||||
addPath = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (addPath)
|
|
||||||
{
|
|
||||||
cdbHeaderPaths.push_back(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic_cast<QtSelectPathsDialog*>(m_filesDialog.get())->setPathsList(cdbHeaderPaths, sourcePaths);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_filesDialog->showWindow();
|
m_filesDialog->showWindow();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class QComboBox;
|
|||||||
class QPushButton;
|
class QPushButton;
|
||||||
class QtDirectoryListBox;
|
class QtDirectoryListBox;
|
||||||
class SourceGroupSettings;
|
class SourceGroupSettings;
|
||||||
|
class SourceGroupSettingsCxxCdb;
|
||||||
|
|
||||||
class QtProjectWizzardContentPaths
|
class QtProjectWizzardContentPaths
|
||||||
: public QtProjectWizzardContent
|
: public QtProjectWizzardContent
|
||||||
@@ -75,10 +76,14 @@ class QtProjectWizzardContentPathsCDBHeader
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static std::vector<FilePath> getTopLevelHeaderSearchPaths(std::shared_ptr<SourceGroupSettingsCxxCdb> settings);
|
||||||
|
|
||||||
QtProjectWizzardContentPathsCDBHeader(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
|
QtProjectWizzardContentPathsCDBHeader(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
|
||||||
|
|
||||||
virtual void populate(QGridLayout* layout, int& row) override;
|
virtual void populate(QGridLayout* layout, int& row) override;
|
||||||
|
|
||||||
|
virtual void load() override;
|
||||||
|
|
||||||
virtual bool check() override;
|
virtual bool check() override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ void QtProjectWizzardContentProjectData::populate(QGridLayout* layout, int& row)
|
|||||||
void QtProjectWizzardContentProjectData::load()
|
void QtProjectWizzardContentProjectData::load()
|
||||||
{
|
{
|
||||||
m_projectName->setText(QString::fromStdString(m_projectSettings->getProjectName()));
|
m_projectName->setText(QString::fromStdString(m_projectSettings->getProjectName()));
|
||||||
m_projectFileLocation->setText(QString::fromStdString(m_projectSettings->getProjectFileLocation().str()));
|
m_projectFileLocation->setText(QString::fromStdString(m_projectSettings->getProjectDirectoryPath().str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtProjectWizzardContentProjectData::save()
|
void QtProjectWizzardContentProjectData::save()
|
||||||
|
|||||||
Reference in New Issue
Block a user