Files
Sourcetrail/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.cpp
T
mlangkabel 7b735cfd17 logic: added project setup support for Sonargraph projects (Java and CMake-JSON modules supported)
* added classes for loading a Sonargraph project
* added Sonargraph options to project setup wizard
* added test for generating indexer commands from Sonargraph modules
* fixed sqlite storage crashing in constructor when parent directory of provided path does not exist
* removed unused FileRegister from Java indexing
* removed unused info from IndexerCommandJava
* refactored loading and saving of SourceGroupSettings
* extracted sourcepaths settings to own class that can be re-used
* merged CDB wizard contentents for source file and indexed paths
* unified wizard content for sonargraph project path
* removed include filters from default source groups
* extracted generation of RefreshInfo from Project to RefreshInfoGenerator
* added tests for RefreshInfoGenerator
* added language and standard selection to sonargraph project setup
* added auto-detection for indexed header paths of sonargraph cmake json modules
* Sonargraph::Project can enable/disable support for specific modules
* warn if sonargraph project contains no matching modules
* indexed headers can be detected from sonargraph project
2018-05-18 16:07:57 +02:00

71 lines
1.9 KiB
C++

#include "qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.h"
#include <QComboBox>
#include <QLabel>
#include "settings/SourceGroupSettings.h"
#include "utility/logging/logging.h"
QtProjectWizzardContentLanguageAndStandard::QtProjectWizzardContentLanguageAndStandard(
std::shared_ptr<SourceGroupSettings> sourceGroupSettings,
QtProjectWizzardWindow* window
)
: QtProjectWizzardContent(window)
, m_sourceGroupSettings(sourceGroupSettings)
, m_language(nullptr)
, m_standard(nullptr)
{
}
void QtProjectWizzardContentLanguageAndStandard::populate(QGridLayout* layout, int& row)
{
if (!isInForm())
{
layout->setRowMinimumHeight(row, 15);
row++;
}
m_language = new QLabel();
layout->addWidget(createFormLabel("Language"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
layout->addWidget(m_language, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
row++;
m_standard = new QComboBox();
layout->addWidget(createFormLabel("Standard"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
layout->addWidget(m_standard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
row++;
if (!isInForm())
{
layout->setRowMinimumHeight(row, 15);
layout->setRowStretch(row, 1);
}
}
void QtProjectWizzardContentLanguageAndStandard::load()
{
const LanguageType type = getLanguageTypeForSourceGroupType(m_sourceGroupSettings->getType());
if (type == LANGUAGE_UNKNOWN)
{
LOG_ERROR("No language type defined");
return;
}
m_language->setText(languageTypeToString(type).c_str());
m_standard->clear();
std::vector<std::string> standards = m_sourceGroupSettings->getAvailableLanguageStandards();
for (size_t i = 0; i < standards.size(); i++)
{
m_standard->insertItem(i, standards[i].c_str());
}
m_standard->setCurrentText(QString::fromStdString(m_sourceGroupSettings->getStandard()));
}
void QtProjectWizzardContentLanguageAndStandard::save()
{
m_sourceGroupSettings->setStandard(m_standard->currentText().toStdString());
}