ui: update list indexed headers when editing the compilation database text box (issue #724)

This commit is contained in:
mlangkabel
2019-10-18 13:05:29 +02:00
committed by Eberhard Graether
parent f7262c805f
commit eb142cfb4e
9 changed files with 53 additions and 24 deletions
@@ -4,6 +4,7 @@
#include "SourceGroupCxxCdb.h"
#include "SourceGroupSettingsCxxCdb.h"
#include "utility.h"
#include "utilitySourceGroupCxx.h"
#include "utilityFile.h"
QtProjectWizardContentPathCDB::QtProjectWizardContentPathCDB(
@@ -37,6 +38,7 @@ void QtProjectWizardContentPathCDB::populate(QGridLayout* layout, int& row)
m_picker->setPickDirectory(false);
m_picker->setFileFilter("JSON Compilation Database (*.json)");
connect(m_picker, &QtLocationPicker::locationPicked, this, &QtProjectWizardContentPathCDB::pickedPath);
connect(m_picker, &QtLocationPicker::textChanged, this, &QtProjectWizardContentPathCDB::onPickerTextChanged);
QLabel* description = new QLabel(
"Sourcetrail will use all include paths and compiler flags from the Compilation Database and stay up-to-date "
@@ -112,6 +114,21 @@ void QtProjectWizardContentPathCDB::pickedPath()
m_window->loadContent();
}
void QtProjectWizardContentPathCDB::onPickerTextChanged(const QString& text)
{
const FilePath cdbPath = utility::getExpandedAndAbsolutePath(FilePath(text.toStdWString()), m_settings->getProjectDirectoryPath());
if (!cdbPath.empty() && cdbPath.exists() &&
cdbPath != m_settings->getCompilationDatabasePathExpandedAndAbsolute())
{
std::string error;
std::shared_ptr<clang::tooling::JSONCompilationDatabase> cdb = utility::loadCDB(cdbPath, &error);
if (cdb && error.empty())
{
pickedPath();
}
}
}
std::shared_ptr<SourceGroupSettings> QtProjectWizardContentPathCDB::getSourceGroupSettings()
{
return m_settings;
@@ -27,6 +27,7 @@ public:
private slots:
void pickedPath();
void onPickerTextChanged(const QString& text);
private:
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
@@ -53,7 +53,7 @@ bool QtProjectWizardContentPathCxxPch::check()
if (std::shared_ptr<SourceGroupSettingsCxxCdb> cdbSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
{
const FilePath cdbPath = cdbSettings->getCompilationDatabasePathExpandedAndAbsolute();
std::shared_ptr<clang::tooling::JSONCompilationDatabase> cdb = IndexerCommandCxx::loadCDB(cdbPath);
std::shared_ptr<clang::tooling::JSONCompilationDatabase> cdb = utility::loadCDB(cdbPath);
if (!cdb)
{
QMessageBox msgBox;