ui: Added file extension UI to project setup
This commit is contained in:
@@ -5,8 +5,17 @@
|
||||
<standard>11</standard>
|
||||
</language_settings>
|
||||
<source>
|
||||
<extensions>
|
||||
<header_extensions>.h</header_extensions>
|
||||
<header_extensions>.hpp</header_extensions>
|
||||
<source_extensions>.cpp</source_extensions>
|
||||
<source_extensions>.cxx</source_extensions>
|
||||
<source_extensions>.cc</source_extensions>
|
||||
<source_extensions>.c</source_extensions>
|
||||
</extensions>
|
||||
<source_paths>
|
||||
<source_path>./src</source_path>
|
||||
<source_path>/Users/ebsi/Documents/Coati/bin/app/data/projects/tictactoe/src</source_path>
|
||||
</source_paths>
|
||||
<use_source_paths_for_header_search>0</use_source_paths_for_header_search>
|
||||
</source>
|
||||
</config>
|
||||
|
||||
@@ -13,10 +13,10 @@ std::vector<std::string> ProjectSettings::getDefaultHeaderExtensions()
|
||||
std::vector<std::string> ProjectSettings::getDefaultSourceExtensions()
|
||||
{
|
||||
std::vector<std::string> defaultValues;
|
||||
defaultValues.push_back(".c");
|
||||
defaultValues.push_back(".cpp");
|
||||
defaultValues.push_back(".cxx");
|
||||
defaultValues.push_back(".cc");
|
||||
defaultValues.push_back(".c");
|
||||
return defaultValues;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,9 @@ bool ProjectSettings::operator==(const ProjectSettings& other) const
|
||||
utility::isPermutation<FilePath>(getSourcePaths(), other.getSourcePaths()) &&
|
||||
utility::isPermutation<FilePath>(getHeaderSearchPaths(), other.getHeaderSearchPaths()) &&
|
||||
utility::isPermutation<FilePath>(getFrameworkSearchPaths(), other.getFrameworkSearchPaths()) &&
|
||||
utility::isPermutation<std::string>(getCompilerFlags(), other.getCompilerFlags());
|
||||
utility::isPermutation<std::string>(getCompilerFlags(), other.getCompilerFlags()) &&
|
||||
utility::isPermutation<std::string>(getHeaderExtensions(), other.getHeaderExtensions()) &&
|
||||
utility::isPermutation<std::string>(getSourceExtensions(), other.getSourceExtensions());
|
||||
}
|
||||
|
||||
void ProjectSettings::save(const FilePath& filePath)
|
||||
|
||||
@@ -26,7 +26,7 @@ void FileRegister::setFilePaths(const std::vector<FilePath>& filePaths)
|
||||
{
|
||||
m_sourceFilePaths.emplace(path, STATE_UNPARSED);
|
||||
}
|
||||
else
|
||||
else if (m_fileManager->hasIncludeExtension(path))
|
||||
{
|
||||
m_includeFilePaths.emplace(path, STATE_UNPARSED);
|
||||
}
|
||||
|
||||
@@ -111,6 +111,8 @@ add_files(
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentData.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentData.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentExtensions.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentExtensions.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentFlags.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentData.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentExtensions.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentFlags.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h"
|
||||
@@ -537,6 +538,7 @@ void QtProjectWizzard::showSummary()
|
||||
}
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentFlags(settings, window), true, false);
|
||||
summary->addContent(new QtProjectWizzardContentExtensions(settings, window), true, true);
|
||||
|
||||
window->setup();
|
||||
|
||||
|
||||
@@ -134,6 +134,9 @@ void QtProjectWizzardContentBuildFile::refreshClicked()
|
||||
FilePath path = FilePath(m_picker->getText().toStdString());
|
||||
if (!path.exists())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Please enter a valid file path.");
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,11 +34,15 @@ void QtProjectWizzardContentCDBSource::populateWindow(QGridLayout* layout, int&
|
||||
void QtProjectWizzardContentCDBSource::load()
|
||||
{
|
||||
std::vector<FilePath> filePaths = TaskParseCxx::getSourceFilesFromCDB(m_settings->getCompilationDatabasePath());
|
||||
std::vector<std::string> extensions = m_settings->getSourceExtensions();
|
||||
|
||||
m_fileNames.clear();
|
||||
for (const FilePath& path : filePaths)
|
||||
{
|
||||
m_fileNames << QString::fromStdString(path.str());
|
||||
if (path.hasExtension(extensions))
|
||||
{
|
||||
m_fileNames << QString::fromStdString(path.str());
|
||||
}
|
||||
}
|
||||
|
||||
if (m_text)
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentExtensions.h"
|
||||
|
||||
#include <QFormLayout>
|
||||
|
||||
#include "qt/element/QtDirectoryListBox.h"
|
||||
|
||||
QtProjectWizzardContentExtensions::QtProjectWizzardContentExtensions(
|
||||
ProjectSettings* settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(settings, window)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentExtensions::populateForm(QGridLayout* layout, int& row)
|
||||
{
|
||||
QLabel* headerLabel = createFormLabel("Header File Extensions");
|
||||
headerLabel->setObjectName("label");
|
||||
layout->addWidget(headerLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
|
||||
addHelpButton("Define extensions for header files including the dot e.g. .h", layout, row);
|
||||
|
||||
m_headerList = new QtDirectoryListBox(this, true);
|
||||
layout->addWidget(m_headerList, row, QtProjectWizzardWindow::BACK_COL);
|
||||
row++;
|
||||
|
||||
QLabel* sourceLabel = createFormLabel("Source File Extensions");
|
||||
sourceLabel->setObjectName("label");
|
||||
layout->addWidget(sourceLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
|
||||
addHelpButton("Define extensions for source files including the dot e.g. .cpp", layout, row);
|
||||
|
||||
m_sourceList = new QtDirectoryListBox(this, true);
|
||||
layout->addWidget(m_sourceList, row, QtProjectWizzardWindow::BACK_COL);
|
||||
row++;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentExtensions::load()
|
||||
{
|
||||
m_headerList->setStringList(m_settings->getHeaderExtensions());
|
||||
m_sourceList->setStringList(m_settings->getSourceExtensions());
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentExtensions::save()
|
||||
{
|
||||
m_settings->setHeaderExtensions(m_headerList->getStringList());
|
||||
m_settings->setSourceExtensions(m_sourceList->getStringList());
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_EXTENSIONS_H
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_EXTENSIONS_H
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QtDirectoryListBox;
|
||||
|
||||
class QtProjectWizzardContentExtensions
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentExtensions(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populateForm(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
private:
|
||||
QtDirectoryListBox* m_headerList;
|
||||
QtDirectoryListBox* m_sourceList;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_EXTENSIONS_H
|
||||
Reference in New Issue
Block a user