logic: Added compilation database project setup
* Added CDB option to project type selection * show CDB source files in popup * define header paths separately * made generic content summary in wizzard and use it everywhere * fixed file paths not canonical in analysis * refactored wizzard content paths to use summary instead of subpaths * refactored files popup to simpler communication with content bug id = 35
This commit is contained in:
@@ -107,14 +107,14 @@ add_files(
|
||||
qt/window/project_wizzard/QtProjectWizzardContent.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentData.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentData.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentFlags.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentPaths.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentPreferences.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentSelect.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp
|
||||
|
||||
@@ -21,6 +21,11 @@ QtWindowStackElement* QtWindowStack::getTopWindow()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t QtWindowStack::getWindowCount()
|
||||
{
|
||||
return m_stack.size();
|
||||
}
|
||||
|
||||
void QtWindowStack::pushWindow(QtWindowStackElement* window)
|
||||
{
|
||||
if (m_stack.size())
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
QtWindowStack(QObject* parent = nullptr);
|
||||
|
||||
QtWindowStackElement* getTopWindow();
|
||||
size_t getWindowCount();
|
||||
|
||||
public slots:
|
||||
void pushWindow(QtWindowStackElement* window);
|
||||
|
||||
@@ -5,15 +5,16 @@
|
||||
#include <QSysInfo>
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
#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/QtProjectWizzardContentFlags.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPreferences.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSourceList.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSummary.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
|
||||
#include "utility/messaging/type/MessageLoadProject.h"
|
||||
#include "utility/solution/SolutionParserCompilationDatabase.h"
|
||||
#include "utility/solution/SolutionParserVisualStudio.h"
|
||||
|
||||
QtProjectWizzard::QtProjectWizzard(QWidget* parent)
|
||||
@@ -64,11 +65,15 @@ void QtProjectWizzard::newProjectFromVisualStudioSolution(const std::string& vis
|
||||
|
||||
editProject(settings);
|
||||
|
||||
QWidget* window = m_windowStack.getTopWindow();
|
||||
QWidget* widget = m_windowStack.getTopWindow();
|
||||
|
||||
if (window)
|
||||
if (widget)
|
||||
{
|
||||
dynamic_cast<QtProjectWizzardWindow*>(window)->updateTitle("NEW PROJECT FROM VS SOLUTION");
|
||||
QtProjectWizzardWindow* window = dynamic_cast<QtProjectWizzardWindow*>(widget);
|
||||
|
||||
window->updateTitle("NEW PROJECT FROM VS SOLUTION");
|
||||
window->updateNextButton("Create");
|
||||
window->setPreviousVisible(m_windowStack.getWindowCount() > 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,16 +99,9 @@ void QtProjectWizzard::refreshProjectFromVisualStudioSolution(const std::string&
|
||||
|
||||
void QtProjectWizzard::newProjectFromCompilationDatabase(const std::string& compilationDatabasePath)
|
||||
{
|
||||
ProjectSettings settings = getSettingsForCompilationDatabase(compilationDatabasePath);
|
||||
m_settings = getSettingsForCompilationDatabase(compilationDatabasePath);
|
||||
|
||||
editProject(settings);
|
||||
|
||||
QWidget* window = m_windowStack.getTopWindow();
|
||||
|
||||
if (window)
|
||||
{
|
||||
dynamic_cast<QtProjectWizzardWindow*>(window)->updateTitle("NEW PROJECT FROM COMPILATION DATABASE");
|
||||
}
|
||||
headerPathsCDB();
|
||||
}
|
||||
|
||||
void QtProjectWizzard::refreshProjectFromCompilationDatabase(const std::string& compilationDatabasePath)
|
||||
@@ -141,14 +139,33 @@ void QtProjectWizzard::editProject(const ProjectSettings& settings)
|
||||
|
||||
window->updateTitle("EDIT PROJECT");
|
||||
window->updateNextButton("Save");
|
||||
|
||||
window->setPreviousVisible(false);
|
||||
connect(window, SIGNAL(next()), this, SLOT(createProject()));
|
||||
}
|
||||
|
||||
void QtProjectWizzard::showPreferences()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentPreferences>();
|
||||
QtProjectWizzardWindow* window = createWindowWithSummary(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
|
||||
{
|
||||
summary->setIsForm(true);
|
||||
|
||||
ProjectSettings* settings = &m_settings;
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(settings, window), false, false);
|
||||
|
||||
if (QSysInfo::macVersion() != QSysInfo::MV_None)
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(settings, window), false, false);
|
||||
}
|
||||
|
||||
window->setup();
|
||||
|
||||
window->updateTitle("PREFERENCES");
|
||||
window->updateNextButton("Save");
|
||||
window->setPreviousVisible(false);
|
||||
}
|
||||
);
|
||||
|
||||
connect(window, SIGNAL(next()), this, SLOT(cancelWizzard()));
|
||||
}
|
||||
|
||||
@@ -157,12 +174,30 @@ QtProjectWizzardWindow* QtProjectWizzard::createWindowWithContent()
|
||||
{
|
||||
QtProjectWizzardWindow* window = new QtProjectWizzardWindow(parentWidget());
|
||||
|
||||
connect(window, SIGNAL(previous()), &m_windowStack, SLOT(popWindow()));
|
||||
connect(window, SIGNAL(canceled()), this, SLOT(cancelWizzard()));
|
||||
|
||||
window->setContent(new T(&m_settings, window));
|
||||
window->setup();
|
||||
|
||||
m_windowStack.pushWindow(window);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
QtProjectWizzardWindow* QtProjectWizzard::createWindowWithSummary(
|
||||
std::function<void(QtProjectWizzardWindow*, QtProjectWizzardContentSummary*)> func
|
||||
){
|
||||
QtProjectWizzardWindow* window = new QtProjectWizzardWindow(parentWidget());
|
||||
|
||||
connect(window, SIGNAL(previous()), &m_windowStack, SLOT(popWindow()));
|
||||
connect(window, SIGNAL(canceled()), this, SLOT(cancelWizzard()));
|
||||
|
||||
QtProjectWizzardContentSummary* summary = new QtProjectWizzardContentSummary(&m_settings, window);
|
||||
|
||||
window->setContent(summary);
|
||||
func(window, summary);
|
||||
|
||||
m_windowStack.pushWindow(window);
|
||||
|
||||
return window;
|
||||
@@ -232,43 +267,17 @@ ProjectSettings QtProjectWizzard::getSettingsForVisualStudioSolution(const std::
|
||||
|
||||
ProjectSettings QtProjectWizzard::getSettingsForCompilationDatabase(const std::string& compilationDatabasePath) const
|
||||
{
|
||||
// SolutionParserCompilationDatabase parser;
|
||||
// parser.openSolutionFile(compilationDatabasePath);
|
||||
// parser.parseDatabase();
|
||||
|
||||
ProjectSettings settings;
|
||||
// settings.setProjectName(parser.getSolutionName());
|
||||
// settings.setProjectFileLocation(parser.getSolutionPath());
|
||||
// settings.setCompilationDatabasePath(FilePath(compilationDatabasePath));
|
||||
|
||||
// std::vector<std::string> sourceFiles = parser.getProjectItems();
|
||||
// std::vector<FilePath> sourcePaths;
|
||||
// for (const std::string& p : sourceFiles)
|
||||
// {
|
||||
// sourcePaths.push_back(FilePath(p));
|
||||
// }
|
||||
|
||||
// std::vector<std::string> includePaths = parser.getIncludePaths();
|
||||
// std::vector<FilePath> headerPaths;
|
||||
// for (const std::string& p : includePaths)
|
||||
// {
|
||||
// headerPaths.push_back(FilePath(p));
|
||||
// }
|
||||
|
||||
// std::vector<std::string> frameworkPaths = parser.getFrameworkPaths();
|
||||
// std::vector<FilePath> frameworkSearchPaths;
|
||||
// for (const std::string& p : frameworkPaths)
|
||||
// {
|
||||
// frameworkSearchPaths.push_back(FilePath(p));
|
||||
// }
|
||||
|
||||
// settings.setSourcePaths(sourcePaths);
|
||||
// settings.setHeaderSearchPaths(headerPaths);
|
||||
// settings.setFrameworkSearchPaths(frameworkSearchPaths);
|
||||
|
||||
settings.setCompilationDatabasePath(FilePath(compilationDatabasePath));
|
||||
return settings;
|
||||
}
|
||||
|
||||
void QtProjectWizzard::connectShowFiles(QtProjectWizzardContent* content)
|
||||
{
|
||||
connect(content, SIGNAL(filesButtonClicked(QtProjectWizzardContent*)),
|
||||
this, SLOT(showFiles(QtProjectWizzardContent*)));
|
||||
}
|
||||
|
||||
void QtProjectWizzard::cancelWizzard()
|
||||
{
|
||||
m_windowStack.clearWindows();
|
||||
@@ -360,14 +369,23 @@ void QtProjectWizzard::sourcePaths()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentPathsSource>();
|
||||
connect(window, SIGNAL(next()), this, SLOT(headerSearchPaths()));
|
||||
|
||||
connect(dynamic_cast<QtProjectWizzardContentPathsSource*>(window->content()),
|
||||
SIGNAL(showSourceFiles()), this, SLOT(showSourceFiles()));
|
||||
connectShowFiles(window->content());
|
||||
}
|
||||
|
||||
void QtProjectWizzard::headerSearchPaths()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentPathsHeaderSearch>();
|
||||
QtProjectWizzardWindow* window = createWindowWithSummary(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
|
||||
{
|
||||
ProjectSettings* settings = &m_settings;
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(settings, window), false, false);
|
||||
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(settings, window), false, false);
|
||||
|
||||
window->setup();
|
||||
}
|
||||
);
|
||||
|
||||
connect(window, SIGNAL(next()), this, SLOT(headerSearchPathsDone()));
|
||||
}
|
||||
|
||||
@@ -375,14 +393,23 @@ void QtProjectWizzard::simpleSourcePaths()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentPathsSourceSimple>();
|
||||
connect(window, SIGNAL(next()), this, SLOT(simpleHeaderSearchPaths()));
|
||||
|
||||
connect(dynamic_cast<QtProjectWizzardContentPathsSourceSimple*>(window->content()),
|
||||
SIGNAL(showSourceFiles()), this, SLOT(showSourceFiles()));
|
||||
connectShowFiles(window->content());
|
||||
}
|
||||
|
||||
void QtProjectWizzard::simpleHeaderSearchPaths()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentPathsHeaderSearchSimple>();
|
||||
QtProjectWizzardWindow* window = createWindowWithSummary(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
|
||||
{
|
||||
ProjectSettings* settings = &m_settings;
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchSimple(settings, window), false, false);
|
||||
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(settings, window), false, false);
|
||||
|
||||
window->setup();
|
||||
}
|
||||
);
|
||||
|
||||
connect(window, SIGNAL(next()), this, SLOT(headerSearchPathsDone()));
|
||||
}
|
||||
|
||||
@@ -400,39 +427,125 @@ void QtProjectWizzard::headerSearchPathsDone()
|
||||
|
||||
void QtProjectWizzard::frameworkSearchPaths()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentPathsFrameworkSearch>();
|
||||
QtProjectWizzardWindow* window = createWindowWithSummary(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
|
||||
{
|
||||
ProjectSettings* settings = &m_settings;
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(settings, window), false, false);
|
||||
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(settings, window), false, false);
|
||||
|
||||
window->setup();
|
||||
}
|
||||
);
|
||||
|
||||
connect(window, SIGNAL(next()), this, SLOT(showSummary()));
|
||||
}
|
||||
|
||||
void QtProjectWizzard::showSourceFiles()
|
||||
void QtProjectWizzard::headerPathsCDB()
|
||||
{
|
||||
QWidget* topWindow = m_windowStack.getTopWindow();
|
||||
if (topWindow)
|
||||
{
|
||||
dynamic_cast<QtProjectWizzardWindow*>(topWindow)->content()->save();
|
||||
}
|
||||
QtProjectWizzardWindow* window = createWindowWithSummary(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
|
||||
{
|
||||
ProjectSettings* settings = &m_settings;
|
||||
|
||||
QtProjectWizzardContent* source = new QtProjectWizzardContentCDBSource(settings, window);
|
||||
summary->addContent(source, false, false);
|
||||
connectShowFiles(source);
|
||||
|
||||
QtProjectWizzardContent* header = new QtProjectWizzardContentPathsCDBHeader(settings, window);
|
||||
summary->addContent(header, false, false);
|
||||
connectShowFiles(header);
|
||||
|
||||
window->setup();
|
||||
|
||||
window->updateTitle("NEW PROJECT FROM COMPILATION DATABASE");
|
||||
}
|
||||
);
|
||||
|
||||
connect(window, SIGNAL(next()), this, SLOT(headerPathsCDBDone()));
|
||||
}
|
||||
|
||||
void QtProjectWizzard::headerPathsCDBDone()
|
||||
{
|
||||
showSummary();
|
||||
|
||||
QWidget* widget = m_windowStack.getTopWindow();
|
||||
|
||||
if (widget)
|
||||
{
|
||||
QtProjectWizzardWindow* window = dynamic_cast<QtProjectWizzardWindow*>(widget);
|
||||
|
||||
window->updateTitle("NEW PROJECT FROM COMPILATION DATABASE - SUMMARY");
|
||||
window->updateNextButton("Create");
|
||||
window->setPreviousVisible(m_windowStack.getWindowCount() > 0);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzard::showFiles(QtProjectWizzardContent* content)
|
||||
{
|
||||
QtProjectWizzardWindow* window = createPopupWithContent<QtProjectWizzardContentSourceList>();
|
||||
dynamic_cast<QtProjectWizzardContentSourceList*>(window->content())->showFilesFromSourcePaths();
|
||||
dynamic_cast<QtProjectWizzardContentSourceList*>(window->content())->showFilesFromContent(content);
|
||||
}
|
||||
|
||||
void QtProjectWizzard::showSummary()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentSummary>();
|
||||
QtProjectWizzardWindow* window = createWindowWithSummary(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
|
||||
{
|
||||
summary->setIsForm(true);
|
||||
|
||||
ProjectSettings* settings = &m_settings;
|
||||
|
||||
QtProjectWizzardContentData* data = new QtProjectWizzardContentData(settings, window);
|
||||
summary->addContent(data, false, false);
|
||||
|
||||
QtProjectWizzardContentBuildFile* buildFile = new QtProjectWizzardContentBuildFile(settings, window);
|
||||
|
||||
if (buildFile->getType() != QtProjectWizzardContentSelect::PROJECT_EMPTY)
|
||||
{
|
||||
summary->addContent(buildFile, false, true);
|
||||
|
||||
connect(dynamic_cast<QtProjectWizzardContentBuildFile*>(buildFile),
|
||||
SIGNAL(refreshVisualStudioSolution(const std::string&)),
|
||||
this, SLOT(refreshProjectFromVisualStudioSolution(const std::string&)));
|
||||
}
|
||||
|
||||
if (buildFile->getType() != QtProjectWizzardContentSelect::PROJECT_CDB)
|
||||
{
|
||||
QtProjectWizzardContentPathsSource* source = new QtProjectWizzardContentPathsSource(settings, window);
|
||||
summary->addContent(source, false, true);
|
||||
connectShowFiles(source);
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentSimple(settings, window), false, true);
|
||||
summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(settings, window), false, false);
|
||||
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(settings, window), false, false);
|
||||
|
||||
if (QSysInfo::macVersion() != QSysInfo::MV_None)
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(settings, window), false, true);
|
||||
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(settings, window), false, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QtProjectWizzardContent* headers = new QtProjectWizzardContentPathsCDBHeader(settings, window);
|
||||
summary->addContent(headers, false, true);
|
||||
connectShowFiles(headers);
|
||||
|
||||
data->hideLanguage();
|
||||
}
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentFlags(settings, window), true, false);
|
||||
|
||||
window->setup();
|
||||
|
||||
window->updateTitle("NEW PROJECT - SUMMARY");
|
||||
window->updateNextButton("Create");
|
||||
}
|
||||
);
|
||||
|
||||
connect(window, SIGNAL(next()), this, SLOT(createProject()));
|
||||
|
||||
QtProjectWizzardContentSummary* summary = dynamic_cast<QtProjectWizzardContentSummary*>(window->content());
|
||||
|
||||
connect(dynamic_cast<QtProjectWizzardContentBuildFile*>(summary->contentBuildFile()),
|
||||
SIGNAL(refreshVisualStudioSolution(const std::string&)),
|
||||
this, SLOT(refreshProjectFromVisualStudioSolution(const std::string&)));
|
||||
|
||||
connect(dynamic_cast<QtProjectWizzardContentBuildFile*>(summary->contentBuildFile()),
|
||||
SIGNAL(refreshCompilationDatabase(const std::string&)),
|
||||
this, SLOT(refreshProjectFromCompilationDatabase(const std::string&)));
|
||||
|
||||
connect(dynamic_cast<QtProjectWizzardContentPathsSource*>(summary->contentPathsSource()),
|
||||
SIGNAL(showSourceFiles()), this, SLOT(showSourceFiles()));
|
||||
}
|
||||
|
||||
void QtProjectWizzard::createProject()
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "qt/window/QtWindowStack.h"
|
||||
|
||||
class ProjectSettings;
|
||||
class QtProjectWizzardContentSummary;
|
||||
class QtProjectWizzardWindow;
|
||||
|
||||
class QtProjectWizzard
|
||||
@@ -37,12 +38,16 @@ public slots:
|
||||
private:
|
||||
template<typename T>
|
||||
QtProjectWizzardWindow* createWindowWithContent();
|
||||
QtProjectWizzardWindow* createWindowWithSummary(
|
||||
std::function<void(QtProjectWizzardWindow*, QtProjectWizzardContentSummary*)> func);
|
||||
template<typename T>
|
||||
QtProjectWizzardWindow* createPopupWithContent();
|
||||
|
||||
ProjectSettings getSettingsForVisualStudioSolution(const std::string& visualStudioSolutionPath) const;
|
||||
ProjectSettings getSettingsForCompilationDatabase(const std::string& compilationDatabasePath) const;
|
||||
|
||||
void connectShowFiles(QtProjectWizzardContent* content);
|
||||
|
||||
QtWindowStack m_windowStack;
|
||||
std::shared_ptr<QtProjectWizzardWindow> m_popup;
|
||||
ProjectSettings m_settings;
|
||||
@@ -67,7 +72,11 @@ private slots:
|
||||
void headerSearchPathsDone();
|
||||
void frameworkSearchPaths();
|
||||
|
||||
void showSourceFiles();
|
||||
void headerPathsCDB();
|
||||
void headerPathsCDBDone();
|
||||
|
||||
void showFiles(QtProjectWizzardContent* content);
|
||||
|
||||
void showSummary();
|
||||
|
||||
void createProject();
|
||||
|
||||
@@ -39,6 +39,10 @@ void QtProjectWizzardContent::populateWindow(QGridLayout* layout)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContent::populateWindow(QGridLayout* layout, int& row)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContent::populateForm(QGridLayout* layout, int& row)
|
||||
{
|
||||
}
|
||||
@@ -70,6 +74,21 @@ QSize QtProjectWizzardContent::preferredWindowSize() const
|
||||
return QSize(750, 620);
|
||||
}
|
||||
|
||||
QStringList QtProjectWizzardContent::getFileNames() const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QString QtProjectWizzardContent::getFileNamesTitle() const
|
||||
{
|
||||
return "File List";
|
||||
}
|
||||
|
||||
QString QtProjectWizzardContent::getFileNamesDescription() const
|
||||
{
|
||||
return "files";
|
||||
}
|
||||
|
||||
QLabel* QtProjectWizzardContent::createFormLabel(QString name) const
|
||||
{
|
||||
QLabel* label = new QLabel(name);
|
||||
@@ -97,3 +116,20 @@ QtHelpButton* QtProjectWizzardContent::addHelpButton(QString helpString, QGridLa
|
||||
layout->addWidget(button, row, QtProjectWizzardWindow::HELP_COL, Qt::AlignTop);
|
||||
return button;
|
||||
}
|
||||
|
||||
QPushButton* QtProjectWizzardContent::addFilesButton(QString name, QGridLayout* layout, int row) const
|
||||
{
|
||||
QPushButton* button = new QPushButton(name);
|
||||
button->setObjectName("windowButton");
|
||||
layout->addWidget(button, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignRight | Qt::AlignTop);
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()));
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContent::buttonClicked()
|
||||
{
|
||||
save();
|
||||
|
||||
emit filesButtonClicked(this);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
|
||||
virtual void populateWindow(QWidget* widget);
|
||||
virtual void populateWindow(QGridLayout* layout);
|
||||
virtual void populateWindow(QGridLayout* layout, int& row);
|
||||
virtual void populateForm(QGridLayout* layout, int& row);
|
||||
virtual void windowReady();
|
||||
|
||||
@@ -48,14 +49,25 @@ public:
|
||||
|
||||
virtual QSize preferredWindowSize() const;
|
||||
|
||||
virtual QStringList getFileNames() const;
|
||||
virtual QString getFileNamesTitle() const;
|
||||
virtual QString getFileNamesDescription() const;
|
||||
|
||||
signals:
|
||||
void filesButtonClicked(QtProjectWizzardContent* content);
|
||||
|
||||
protected:
|
||||
QLabel* createFormLabel(QString name) const;
|
||||
QToolButton* createProjectButton(QString name, QString iconPath) const;
|
||||
|
||||
QtHelpButton* addHelpButton(QString helpString, QGridLayout* layout, int row) const;
|
||||
QPushButton* addFilesButton(QString name, QGridLayout* layout, int row) const;
|
||||
|
||||
ProjectSettings* m_settings;
|
||||
QtProjectWizzardWindow* m_window;
|
||||
|
||||
private slots:
|
||||
void buttonClicked();
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_H
|
||||
|
||||
@@ -21,6 +21,11 @@ QtProjectWizzardContentBuildFile::QtProjectWizzardContentBuildFile(
|
||||
}
|
||||
}
|
||||
|
||||
QtProjectWizzardContentSelect::ProjectType QtProjectWizzardContentBuildFile::getType() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentBuildFile::populateForm(QGridLayout* layout, int& row)
|
||||
{
|
||||
QString name;
|
||||
@@ -54,6 +59,11 @@ void QtProjectWizzardContentBuildFile::populateForm(QGridLayout* layout, int& ro
|
||||
button->setToolTip("refresh paths");
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(refreshClicked()));
|
||||
|
||||
if (m_type == QtProjectWizzardContentSelect::PROJECT_CDB)
|
||||
{
|
||||
button->hide();
|
||||
}
|
||||
|
||||
m_picker->layout()->addWidget(button);
|
||||
|
||||
layout->addWidget(m_picker, row, QtProjectWizzardWindow::BACK_COL);
|
||||
@@ -76,6 +86,49 @@ void QtProjectWizzardContentBuildFile::load()
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentBuildFile::save()
|
||||
{
|
||||
switch (m_type)
|
||||
{
|
||||
case QtProjectWizzardContentSelect::PROJECT_EMPTY:
|
||||
case QtProjectWizzardContentSelect::PROJECT_VS:
|
||||
break;
|
||||
case QtProjectWizzardContentSelect::PROJECT_CDB:
|
||||
{
|
||||
FilePath path = m_picker->getText().toStdString();
|
||||
if (!path.exists() || path.extension() != ".json")
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_settings->setCompilationDatabasePath(m_picker->getText().toStdString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentBuildFile::check()
|
||||
{
|
||||
switch (m_type)
|
||||
{
|
||||
case QtProjectWizzardContentSelect::PROJECT_EMPTY:
|
||||
case QtProjectWizzardContentSelect::PROJECT_VS:
|
||||
break;
|
||||
case QtProjectWizzardContentSelect::PROJECT_CDB:
|
||||
{
|
||||
FilePath path = m_picker->getText().toStdString();
|
||||
if (!path.exists() || path.extension() != ".json")
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Please enter a valid compilation database file (*.json).");
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentBuildFile::refreshClicked()
|
||||
{
|
||||
FilePath path = FilePath(m_picker->getText().toStdString());
|
||||
@@ -101,14 +154,10 @@ void QtProjectWizzardContentBuildFile::refreshClicked()
|
||||
switch (m_type)
|
||||
{
|
||||
case QtProjectWizzardContentSelect::PROJECT_EMPTY:
|
||||
case QtProjectWizzardContentSelect::PROJECT_CDB:
|
||||
break;
|
||||
case QtProjectWizzardContentSelect::PROJECT_VS:
|
||||
{
|
||||
emit refreshVisualStudioSolution(path.str());
|
||||
break;
|
||||
}
|
||||
case QtProjectWizzardContentSelect::PROJECT_CDB:
|
||||
emit refreshCompilationDatabase(path.str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,15 +14,18 @@ class QtProjectWizzardContentBuildFile
|
||||
|
||||
signals:
|
||||
void refreshVisualStudioSolution(const std::string&);
|
||||
void refreshCompilationDatabase(const std::string&);
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentBuildFile(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
QtProjectWizzardContentSelect::ProjectType getType() const;
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populateForm(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
virtual bool check() override;
|
||||
|
||||
private slots:
|
||||
void refreshClicked();
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h"
|
||||
|
||||
#include "data/parser/cxx/TaskParseCxx.h"
|
||||
|
||||
QtProjectWizzardContentCDBSource::QtProjectWizzardContentCDBSource(
|
||||
ProjectSettings* settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(settings, window)
|
||||
, m_text(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCDBSource::populateWindow(QGridLayout* layout, int& row)
|
||||
{
|
||||
layout->setRowMinimumHeight(row++, 10);
|
||||
|
||||
QLabel* title = new QLabel("Source Files");
|
||||
title->setWordWrap(true);
|
||||
title->setObjectName("section");
|
||||
layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
|
||||
layout->setRowStretch(row, 0);
|
||||
|
||||
m_text = new QLabel("");
|
||||
layout->addWidget(m_text, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignTop);
|
||||
|
||||
addFilesButton("show source files", layout, row + 1);
|
||||
|
||||
row += 2;
|
||||
|
||||
layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1);
|
||||
layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 2);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCDBSource::load()
|
||||
{
|
||||
std::vector<FilePath> filePaths = TaskParseCxx::getSourceFilesFromCDB(m_settings->getCompilationDatabasePath());
|
||||
|
||||
m_fileNames.clear();
|
||||
for (const FilePath& path : filePaths)
|
||||
{
|
||||
m_fileNames << QString::fromStdString(path.str());
|
||||
}
|
||||
|
||||
if (m_text)
|
||||
{
|
||||
m_text->setText(QString::number(m_fileNames.size()) + " source files were found in the compilation database.");
|
||||
}
|
||||
}
|
||||
|
||||
QStringList QtProjectWizzardContentCDBSource::getFileNames() const
|
||||
{
|
||||
return m_fileNames;
|
||||
}
|
||||
|
||||
QString QtProjectWizzardContentCDBSource::getFileNamesTitle() const
|
||||
{
|
||||
return "Source Files";
|
||||
}
|
||||
|
||||
QString QtProjectWizzardContentCDBSource::getFileNamesDescription() const
|
||||
{
|
||||
return "source files will be analyzed.";
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_CDB_SOURCE_H
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_CDB_SOURCE_H
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QtProjectWizzardContentCDBSource
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentCDBSource(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populateWindow(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
|
||||
virtual QStringList getFileNames() const override;
|
||||
virtual QString getFileNamesTitle() const override;
|
||||
virtual QString getFileNamesDescription() const override;
|
||||
|
||||
private:
|
||||
QLabel* m_text;
|
||||
QStringList m_fileNames;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_CDB_SOURCE_H
|
||||
@@ -5,9 +5,15 @@
|
||||
|
||||
QtProjectWizzardContentData::QtProjectWizzardContentData(ProjectSettings* settings, QtProjectWizzardWindow* window)
|
||||
: QtProjectWizzardContent(settings, window)
|
||||
, m_showLanguage(true)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentData::hideLanguage()
|
||||
{
|
||||
m_showLanguage = false;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentData::populateWindow(QGridLayout* layout)
|
||||
{
|
||||
int row = 0;
|
||||
@@ -42,6 +48,7 @@ void QtProjectWizzardContentData::populateForm(QGridLayout* layout, int& row)
|
||||
layout->addWidget(m_projectFileLocation, row, QtProjectWizzardWindow::BACK_COL);
|
||||
row++;
|
||||
|
||||
|
||||
QLabel* languageLabel = new QLabel("Language");
|
||||
languageLabel->setObjectName("label");
|
||||
m_language = new QComboBox();
|
||||
@@ -49,13 +56,8 @@ void QtProjectWizzardContentData::populateForm(QGridLayout* layout, int& row)
|
||||
m_language->insertItem(1, "C");
|
||||
connect(m_language, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int)));
|
||||
|
||||
layout->addWidget(languageLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_language, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
row++;
|
||||
|
||||
|
||||
QLabel* standardLabel = createFormLabel("Standard");
|
||||
layout->addWidget(standardLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
|
||||
m_cppStandard = new QComboBox();
|
||||
m_cppStandard->insertItem(0, "1z");
|
||||
@@ -66,8 +68,6 @@ void QtProjectWizzardContentData::populateForm(QGridLayout* layout, int& row)
|
||||
m_cppStandard->insertItem(5, "03");
|
||||
m_cppStandard->insertItem(6, "98");
|
||||
|
||||
layout->addWidget(m_cppStandard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
|
||||
m_cStandard = new QComboBox();
|
||||
m_cStandard->insertItem(0, "1x");
|
||||
m_cStandard->insertItem(1, "11");
|
||||
@@ -76,7 +76,26 @@ void QtProjectWizzardContentData::populateForm(QGridLayout* layout, int& row)
|
||||
m_cStandard->insertItem(4, "90");
|
||||
m_cStandard->insertItem(5, "89");
|
||||
|
||||
layout->addWidget(m_cStandard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
if (m_showLanguage)
|
||||
{
|
||||
layout->addWidget(languageLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_language, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
|
||||
row++;
|
||||
|
||||
layout->addWidget(standardLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_cppStandard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
layout->addWidget(m_cStandard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
}
|
||||
else
|
||||
{
|
||||
languageLabel->hide();
|
||||
m_language->hide();
|
||||
|
||||
standardLabel->hide();
|
||||
m_cppStandard->hide();
|
||||
m_cStandard->hide();
|
||||
}
|
||||
|
||||
row++;
|
||||
}
|
||||
@@ -158,6 +177,11 @@ QSize QtProjectWizzardContentData::preferredWindowSize() const
|
||||
|
||||
void QtProjectWizzardContentData::handleSelectionChanged(int index)
|
||||
{
|
||||
if (!m_showLanguage)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (index != 0)
|
||||
{
|
||||
m_cStandard->show();
|
||||
|
||||
@@ -15,6 +15,8 @@ class QtProjectWizzardContentData
|
||||
public:
|
||||
QtProjectWizzardContentData(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
void hideLanguage();
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populateWindow(QGridLayout* layout) override;
|
||||
virtual void populateForm(QGridLayout* layout, int& row) override;
|
||||
@@ -33,6 +35,8 @@ private:
|
||||
QComboBox* m_cppStandard;
|
||||
QComboBox* m_cStandard;
|
||||
|
||||
bool m_showLanguage;
|
||||
|
||||
private slots:
|
||||
void handleSelectionChanged(int index);
|
||||
};
|
||||
|
||||
@@ -6,47 +6,24 @@
|
||||
|
||||
#include "qt/element/QtDirectoryListBox.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/utility.h"
|
||||
|
||||
QtProjectWizzardContentPaths::QtProjectWizzardContentPaths(ProjectSettings* settings, QtProjectWizzardWindow* window)
|
||||
: QtProjectWizzardContent(settings, window)
|
||||
, m_subPaths(nullptr)
|
||||
, m_addShowSourcesButton(false)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPaths::populateWindow(QGridLayout* layout)
|
||||
{
|
||||
int row = 0;
|
||||
|
||||
layout->setRowMinimumHeight(row, 10);
|
||||
row++;
|
||||
|
||||
populateLayout(layout, row);
|
||||
|
||||
if (m_addShowSourcesButton)
|
||||
{
|
||||
layout->setRowStretch(row, 10);
|
||||
addSourcesButton(layout, row);
|
||||
}
|
||||
|
||||
if (m_subPaths)
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 30);
|
||||
row++;
|
||||
|
||||
m_subPaths->populateLayout(layout, row);
|
||||
|
||||
layout->setRowMinimumHeight(row, 10);
|
||||
row++;
|
||||
}
|
||||
|
||||
layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1);
|
||||
layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 2);
|
||||
populateWindow(layout, row);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPaths::populateLayout(QGridLayout* layout, int& row)
|
||||
void QtProjectWizzardContentPaths::populateWindow(QGridLayout* layout, int& row)
|
||||
{
|
||||
layout->setRowMinimumHeight(row++, 10);
|
||||
|
||||
QLabel* title = new QLabel(m_titleString);
|
||||
title->setWordWrap(true);
|
||||
title->setObjectName("section");
|
||||
@@ -63,6 +40,17 @@ void QtProjectWizzardContentPaths::populateLayout(QGridLayout* layout, int& row)
|
||||
layout->addWidget(m_list, row, QtProjectWizzardWindow::BACK_COL, 2, 1, Qt::AlignTop);
|
||||
|
||||
row += 2;
|
||||
|
||||
if (m_showFilesString.size() > 0)
|
||||
{
|
||||
layout->setRowStretch(row, 10);
|
||||
addFilesButton(m_showFilesString, layout, row);
|
||||
}
|
||||
|
||||
row++;
|
||||
|
||||
layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1);
|
||||
layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 2);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPaths::populateForm(QGridLayout* layout, int& row)
|
||||
@@ -79,45 +67,11 @@ void QtProjectWizzardContentPaths::populateForm(QGridLayout* layout, int& row)
|
||||
layout->addWidget(m_list, row, QtProjectWizzardWindow::BACK_COL);
|
||||
row++;
|
||||
|
||||
if (m_addShowSourcesButton)
|
||||
if (m_showFilesString.size() > 0)
|
||||
{
|
||||
addSourcesButton(layout, row);
|
||||
addFilesButton(m_showFilesString, layout, row);
|
||||
row++;
|
||||
}
|
||||
|
||||
if (m_subPaths)
|
||||
{
|
||||
m_subPaths->populateForm(layout, row);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPaths::load()
|
||||
{
|
||||
loadPaths();
|
||||
|
||||
if (m_subPaths)
|
||||
{
|
||||
return m_subPaths->loadPaths();
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPaths::save()
|
||||
{
|
||||
savePaths();
|
||||
|
||||
if (m_subPaths)
|
||||
{
|
||||
m_subPaths->savePaths();
|
||||
}
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentPaths::check()
|
||||
{
|
||||
if (m_subPaths)
|
||||
{
|
||||
return checkPaths() && m_subPaths->checkPaths();
|
||||
}
|
||||
|
||||
return checkPaths();
|
||||
}
|
||||
|
||||
QSize QtProjectWizzardContentPaths::preferredWindowSize() const
|
||||
@@ -125,19 +79,6 @@ QSize QtProjectWizzardContentPaths::preferredWindowSize() const
|
||||
return QSize(850, 500);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPaths::loadPaths()
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPaths::savePaths()
|
||||
{
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentPaths::checkPaths()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPaths::setInfo(const QString& title, const QString& description, const QString& help)
|
||||
{
|
||||
m_titleString = title;
|
||||
@@ -160,31 +101,12 @@ void QtProjectWizzardContentPaths::setHelpString(const QString& help)
|
||||
m_helpString = help;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPaths::showSourcesClicked()
|
||||
{
|
||||
emit showSourceFiles();
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPaths::addSourcesButton(QGridLayout* layout, int& row)
|
||||
{
|
||||
if (!m_addShowSourcesButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QPushButton* button = new QPushButton("show files");
|
||||
button->setObjectName("windowButton");
|
||||
layout->addWidget(button, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignRight | Qt::AlignTop);
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(showSourcesClicked()));
|
||||
row++;
|
||||
}
|
||||
|
||||
QtProjectWizzardContentPathsSource::QtProjectWizzardContentPathsSource(
|
||||
ProjectSettings* settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContentPaths(settings, window)
|
||||
{
|
||||
m_addShowSourcesButton = true;
|
||||
m_showFilesString = "show files";
|
||||
|
||||
setInfo(
|
||||
"Project Paths",
|
||||
@@ -200,17 +122,17 @@ QSize QtProjectWizzardContentPathsSource::preferredWindowSize() const
|
||||
return QSize(850, 370);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsSource::loadPaths()
|
||||
void QtProjectWizzardContentPathsSource::load()
|
||||
{
|
||||
m_list->setList(m_settings->getSourcePaths());
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsSource::savePaths()
|
||||
void QtProjectWizzardContentPathsSource::save()
|
||||
{
|
||||
m_settings->setSourcePaths(m_list->getList());
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentPathsSource::checkPaths()
|
||||
bool QtProjectWizzardContentPathsSource::check()
|
||||
{
|
||||
if (m_list->getList().size() == 0)
|
||||
{
|
||||
@@ -223,12 +145,58 @@ bool QtProjectWizzardContentPathsSource::checkPaths()
|
||||
return true;
|
||||
}
|
||||
|
||||
QStringList QtProjectWizzardContentPathsSource::getFileNames() const
|
||||
{
|
||||
return getSourceFileNames(false);
|
||||
}
|
||||
|
||||
QString QtProjectWizzardContentPathsSource::getFileNamesTitle() const
|
||||
{
|
||||
return "Analyzed Files";
|
||||
}
|
||||
|
||||
QString QtProjectWizzardContentPathsSource::getFileNamesDescription() const
|
||||
{
|
||||
return "files will be analyzed.";
|
||||
}
|
||||
|
||||
QStringList QtProjectWizzardContentPathsSource::getSourceFileNames(bool headersOnly) const
|
||||
{
|
||||
std::vector<FilePath> sourcePaths = m_settings->getSourcePaths();
|
||||
|
||||
std::vector<std::string> extensions;
|
||||
if (!headersOnly)
|
||||
{
|
||||
utility::append(extensions, m_settings->getSourceExtensions());
|
||||
}
|
||||
utility::append(extensions, m_settings->getHeaderExtensions());
|
||||
|
||||
std::vector<FileInfo> fileInfos = FileSystem::getFileInfosFromPaths(sourcePaths, extensions);
|
||||
|
||||
FilePath projectPath = FilePath(m_settings->getProjectFileLocation());
|
||||
|
||||
QStringList list;
|
||||
for (const FileInfo& info : fileInfos)
|
||||
{
|
||||
FilePath path = info.path;
|
||||
|
||||
if (projectPath.exists())
|
||||
{
|
||||
path = path.relativeTo(projectPath);
|
||||
}
|
||||
|
||||
list << QString::fromStdString(path.str());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
QtProjectWizzardContentPathsSourceSimple::QtProjectWizzardContentPathsSourceSimple(
|
||||
ProjectSettings* settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContentPathsSource(settings, window)
|
||||
{
|
||||
m_addShowSourcesButton = true;
|
||||
m_showFilesString = "show files";
|
||||
|
||||
setTitleString("Project Paths");
|
||||
setDescriptionString(
|
||||
@@ -237,6 +205,43 @@ QtProjectWizzardContentPathsSourceSimple::QtProjectWizzardContentPathsSourceSimp
|
||||
);
|
||||
}
|
||||
|
||||
QtProjectWizzardContentPathsCDBHeader::QtProjectWizzardContentPathsCDBHeader(
|
||||
ProjectSettings* settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContentPathsSource(settings, window)
|
||||
{
|
||||
m_showFilesString = "show header files";
|
||||
|
||||
setTitleString("Header Paths");
|
||||
setDescriptionString(
|
||||
"Add the header files or directories containing the header files of the source files above. These header files "
|
||||
"will be analyzed if included."
|
||||
);
|
||||
setHelpString(
|
||||
"The compilation database only contains source files. Add the header files or directories containing the header "
|
||||
"files of these source files. The header files will be analyzed if included."
|
||||
);
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentPathsCDBHeader::check()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QStringList QtProjectWizzardContentPathsCDBHeader::getFileNames() const
|
||||
{
|
||||
return getSourceFileNames(true);
|
||||
}
|
||||
|
||||
QString QtProjectWizzardContentPathsCDBHeader::getFileNamesTitle() const
|
||||
{
|
||||
return "Header Files";
|
||||
}
|
||||
|
||||
QString QtProjectWizzardContentPathsCDBHeader::getFileNamesDescription() const
|
||||
{
|
||||
return "header files found.";
|
||||
}
|
||||
|
||||
QtProjectWizzardContentPathsHeaderSearch::QtProjectWizzardContentPathsHeaderSearch(
|
||||
ProjectSettings* settings, QtProjectWizzardWindow* window
|
||||
@@ -250,16 +255,14 @@ QtProjectWizzardContentPathsHeaderSearch::QtProjectWizzardContentPathsHeaderSear
|
||||
"header files of frameworks or libraries that your project uses. These files won't be analyzed, but Coati needs "
|
||||
"them for correct analysis."
|
||||
);
|
||||
|
||||
m_subPaths = new QtProjectWizzardContentPathsHeaderSearchGlobal(settings, window);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsHeaderSearch::loadPaths()
|
||||
void QtProjectWizzardContentPathsHeaderSearch::load()
|
||||
{
|
||||
m_list->setList(m_settings->getHeaderSearchPaths());
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsHeaderSearch::savePaths()
|
||||
void QtProjectWizzardContentPathsHeaderSearch::save()
|
||||
{
|
||||
m_settings->setHeaderSearchPaths(m_list->getList());
|
||||
}
|
||||
@@ -298,12 +301,12 @@ QtProjectWizzardContentPathsHeaderSearchGlobal::QtProjectWizzardContentPathsHead
|
||||
);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsHeaderSearchGlobal::loadPaths()
|
||||
void QtProjectWizzardContentPathsHeaderSearchGlobal::load()
|
||||
{
|
||||
m_list->setList(ApplicationSettings::getInstance()->getHeaderSearchPaths());
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsHeaderSearchGlobal::savePaths()
|
||||
void QtProjectWizzardContentPathsHeaderSearchGlobal::save()
|
||||
{
|
||||
ApplicationSettings::getInstance()->setHeaderSearchPaths(m_list->getList());
|
||||
ApplicationSettings::getInstance()->save();
|
||||
@@ -321,16 +324,14 @@ QtProjectWizzardContentPathsFrameworkSearch::QtProjectWizzardContentPathsFramewo
|
||||
"Framework Search Paths define where MacOS framework containers (.framework), that your project depends on, are "
|
||||
"found."
|
||||
);
|
||||
|
||||
m_subPaths = new QtProjectWizzardContentPathsFrameworkSearchGlobal(settings, window);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsFrameworkSearch::loadPaths()
|
||||
void QtProjectWizzardContentPathsFrameworkSearch::load()
|
||||
{
|
||||
m_list->setList(m_settings->getFrameworkSearchPaths());
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsFrameworkSearch::savePaths()
|
||||
void QtProjectWizzardContentPathsFrameworkSearch::save()
|
||||
{
|
||||
m_settings->setFrameworkSearchPaths(m_list->getList());
|
||||
}
|
||||
@@ -356,12 +357,12 @@ QtProjectWizzardContentPathsFrameworkSearchGlobal::QtProjectWizzardContentPathsF
|
||||
);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsFrameworkSearchGlobal::loadPaths()
|
||||
void QtProjectWizzardContentPathsFrameworkSearchGlobal::load()
|
||||
{
|
||||
m_list->setList(ApplicationSettings::getInstance()->getFrameworkSearchPaths());
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsFrameworkSearchGlobal::savePaths()
|
||||
void QtProjectWizzardContentPathsFrameworkSearchGlobal::save()
|
||||
{
|
||||
ApplicationSettings::getInstance()->setFrameworkSearchPaths(m_list->getList());
|
||||
ApplicationSettings::getInstance()->save();
|
||||
|
||||
@@ -20,19 +20,11 @@ public:
|
||||
|
||||
// QtSettingsWindow implementation
|
||||
virtual void populateWindow(QGridLayout* layout) override;
|
||||
void populateLayout(QGridLayout* layout, int& row);
|
||||
virtual void populateWindow(QGridLayout* layout, int& row) override;
|
||||
virtual void populateForm(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
virtual bool check() override;
|
||||
|
||||
virtual QSize preferredWindowSize() const override;
|
||||
|
||||
virtual void loadPaths();
|
||||
virtual void savePaths();
|
||||
virtual bool checkPaths();
|
||||
|
||||
protected:
|
||||
void setInfo(const QString& title, const QString& description, const QString& help);
|
||||
void setTitleString(const QString& title);
|
||||
@@ -40,16 +32,10 @@ protected:
|
||||
void setHelpString(const QString& help);
|
||||
|
||||
QtDirectoryListBox* m_list;
|
||||
QtProjectWizzardContentPaths* m_subPaths;
|
||||
|
||||
bool m_addShowSourcesButton;
|
||||
|
||||
private slots:
|
||||
void showSourcesClicked();
|
||||
QString m_showFilesString;
|
||||
|
||||
private:
|
||||
void addSourcesButton(QGridLayout* layout, int& row);
|
||||
|
||||
QString m_titleString;
|
||||
QString m_descriptionString;
|
||||
QString m_helpString;
|
||||
@@ -65,10 +51,16 @@ public:
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual QSize preferredWindowSize() const override;
|
||||
|
||||
// QtProjectWizzardContentPaths implementation
|
||||
virtual void loadPaths() override;
|
||||
virtual void savePaths() override;
|
||||
virtual bool checkPaths() override;
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
virtual bool check() override;
|
||||
|
||||
virtual QStringList getFileNames() const override;
|
||||
virtual QString getFileNamesTitle() const override;
|
||||
virtual QString getFileNamesDescription() const override;
|
||||
|
||||
protected:
|
||||
QStringList getSourceFileNames(bool headersOnly) const;
|
||||
};
|
||||
|
||||
class QtProjectWizzardContentPathsSourceSimple
|
||||
@@ -78,6 +70,20 @@ public:
|
||||
QtProjectWizzardContentPathsSourceSimple(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
};
|
||||
|
||||
class QtProjectWizzardContentPathsCDBHeader
|
||||
: public QtProjectWizzardContentPathsSource
|
||||
{
|
||||
public:
|
||||
QtProjectWizzardContentPathsCDBHeader(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual bool check() override;
|
||||
|
||||
virtual QStringList getFileNames() const override;
|
||||
virtual QString getFileNamesTitle() const override;
|
||||
virtual QString getFileNamesDescription() const override;
|
||||
};
|
||||
|
||||
|
||||
class QtProjectWizzardContentPathsHeaderSearch
|
||||
: public QtProjectWizzardContentPaths
|
||||
@@ -86,8 +92,8 @@ public:
|
||||
QtProjectWizzardContentPathsHeaderSearch(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void loadPaths() override;
|
||||
virtual void savePaths() override;
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
virtual bool isScrollAble() const override;
|
||||
};
|
||||
@@ -106,8 +112,8 @@ public:
|
||||
QtProjectWizzardContentPathsHeaderSearchGlobal(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void loadPaths() override;
|
||||
virtual void savePaths() override;
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
};
|
||||
|
||||
|
||||
@@ -118,8 +124,8 @@ public:
|
||||
QtProjectWizzardContentPathsFrameworkSearch(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void loadPaths() override;
|
||||
virtual void savePaths() override;
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
virtual bool isScrollAble() const override;
|
||||
};
|
||||
@@ -131,8 +137,8 @@ public:
|
||||
QtProjectWizzardContentPathsFrameworkSearchGlobal(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void loadPaths() override;
|
||||
virtual void savePaths() override;
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_PATHS_H
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPreferences.h"
|
||||
|
||||
#include <QSysInfo>
|
||||
|
||||
QtProjectWizzardContentPreferences::QtProjectWizzardContentPreferences(ProjectSettings* settings, QtProjectWizzardWindow* window)
|
||||
: QtProjectWizzardContent(settings, window)
|
||||
, m_headerSearch(nullptr)
|
||||
, m_frameworkSearch(nullptr)
|
||||
{
|
||||
m_headerSearch = new QtProjectWizzardContentPathsHeaderSearchGlobal(settings, window);
|
||||
|
||||
if (QSysInfo::macVersion() != QSysInfo::MV_None)
|
||||
{
|
||||
m_frameworkSearch = new QtProjectWizzardContentPathsFrameworkSearchGlobal(settings, window);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPreferences::populateWindow(QGridLayout* layout)
|
||||
{
|
||||
int row = 0;
|
||||
|
||||
layout->setRowMinimumHeight(row, 10);
|
||||
row++;
|
||||
|
||||
m_headerSearch->populateForm(layout, row);
|
||||
|
||||
if (m_frameworkSearch)
|
||||
{
|
||||
m_frameworkSearch->populateForm(layout, row);
|
||||
}
|
||||
|
||||
layout->setRowMinimumHeight(row, 10);
|
||||
|
||||
layout->setRowStretch(row, 1);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPreferences::windowReady()
|
||||
{
|
||||
m_window->updateTitle("PREFERENCES");
|
||||
m_window->updateNextButton("Save");
|
||||
m_window->setPreviousVisible(false);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPreferences::load()
|
||||
{
|
||||
m_headerSearch->load();
|
||||
|
||||
if (m_frameworkSearch)
|
||||
{
|
||||
m_frameworkSearch->load();
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPreferences::save()
|
||||
{
|
||||
m_headerSearch->save();
|
||||
|
||||
if (m_frameworkSearch)
|
||||
{
|
||||
m_frameworkSearch->save();
|
||||
}
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentPreferences::isScrollAble() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_PREFERENCES_H
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_PREFERENCES_H
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
|
||||
|
||||
class QtProjectWizzardContentPreferences
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
public:
|
||||
QtProjectWizzardContentPreferences(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
protected:
|
||||
// QtProjectContentWindow implementation
|
||||
virtual void populateWindow(QGridLayout* layout) override;
|
||||
virtual void windowReady() override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
virtual bool isScrollAble() const override;
|
||||
|
||||
private:
|
||||
QtProjectWizzardContentPathsHeaderSearchGlobal* m_headerSearch;
|
||||
QtProjectWizzardContentPathsFrameworkSearchGlobal* m_frameworkSearch;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_PREFERENCES_H
|
||||
@@ -67,8 +67,6 @@ void QtProjectWizzardContentSelect::populateWindow(QGridLayout* layout)
|
||||
QToolButton* c = createProjectButton(
|
||||
"from Compilation\nDatabase", (ResourcePaths::getGuiPath() + "icon/project_cdb_256_256.png").c_str());
|
||||
|
||||
c->hide();
|
||||
|
||||
m_buttons = new QButtonGroup(this);
|
||||
m_buttons->addButton(a);
|
||||
m_buttons->addButton(b);
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
#include <QListView>
|
||||
#include <QStringListModel>
|
||||
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/utility.h"
|
||||
|
||||
QtProjectWizzardContentSourceList::QtProjectWizzardContentSourceList(
|
||||
ProjectSettings* settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
@@ -32,7 +29,6 @@ void QtProjectWizzardContentSourceList::populateWindow(QWidget* widget)
|
||||
|
||||
void QtProjectWizzardContentSourceList::windowReady()
|
||||
{
|
||||
m_window->updateTitle("Analyzed Files");
|
||||
}
|
||||
|
||||
QSize QtProjectWizzardContentSourceList::preferredWindowSize() const
|
||||
@@ -40,34 +36,13 @@ QSize QtProjectWizzardContentSourceList::preferredWindowSize() const
|
||||
return QSize(500, 500);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSourceList::showFilesFromSourcePaths()
|
||||
void QtProjectWizzardContentSourceList::showFilesFromContent(QtProjectWizzardContent* content)
|
||||
{
|
||||
std::vector<FilePath> sourcePaths = m_settings->getSourcePaths();
|
||||
QStringList list = content->getFileNames();
|
||||
m_text->setText(QString::number(list.size()) + " " + content->getFileNamesDescription());
|
||||
m_window->updateTitle(content->getFileNamesTitle());
|
||||
|
||||
std::vector<std::string> extensions;
|
||||
utility::append(extensions, m_settings->getSourceExtensions());
|
||||
utility::append(extensions, m_settings->getHeaderExtensions());
|
||||
|
||||
std::vector<FileInfo> fileInfos = FileSystem::getFileInfosFromPaths(sourcePaths, extensions);
|
||||
|
||||
FilePath projectPath = FilePath(m_settings->getProjectFileLocation());
|
||||
|
||||
QStringList list;
|
||||
for (const FileInfo& info : fileInfos)
|
||||
{
|
||||
FilePath path = info.path;
|
||||
|
||||
if (projectPath.exists())
|
||||
{
|
||||
path = path.relativeTo(projectPath);
|
||||
}
|
||||
|
||||
list << QString::fromStdString(path.str());
|
||||
}
|
||||
|
||||
m_text->setText(QString::number(list.size()) + " files will be analyzed.");
|
||||
|
||||
QStringListModel* model = new QStringListModel(this);
|
||||
model->setStringList(list);
|
||||
m_list->setModel(model);
|
||||
QStringListModel* model = new QStringListModel(this);
|
||||
model->setStringList(list);
|
||||
m_list->setModel(model);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
|
||||
virtual QSize preferredWindowSize() const override;
|
||||
|
||||
void showFilesFromSourcePaths();
|
||||
void showFilesFromContent(QtProjectWizzardContent* content);
|
||||
|
||||
private:
|
||||
QLabel* m_text;
|
||||
|
||||
@@ -1,143 +1,134 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSummary.h"
|
||||
|
||||
#include <QSysInfo>
|
||||
|
||||
QtProjectWizzardContentSummary::QtProjectWizzardContentSummary(ProjectSettings* settings, QtProjectWizzardWindow* window)
|
||||
QtProjectWizzardContentSummary::QtProjectWizzardContentSummary(
|
||||
ProjectSettings* settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(settings, window)
|
||||
, m_data(nullptr)
|
||||
, m_buildFile(nullptr)
|
||||
, m_source(nullptr)
|
||||
, m_simple(nullptr)
|
||||
, m_headerSearch(nullptr)
|
||||
, m_frameworkSearch(nullptr)
|
||||
, m_isForm(false)
|
||||
{
|
||||
m_data = new QtProjectWizzardContentData(settings, window);
|
||||
m_buildFile = new QtProjectWizzardContentBuildFile(settings, window);
|
||||
m_source = new QtProjectWizzardContentPathsSource(settings, window);
|
||||
m_simple = new QtProjectWizzardContentSimple(settings, window);
|
||||
m_headerSearch = new QtProjectWizzardContentPathsHeaderSearch(settings, window);
|
||||
|
||||
if (QSysInfo::macVersion() != QSysInfo::MV_None)
|
||||
{
|
||||
m_frameworkSearch = new QtProjectWizzardContentPathsFrameworkSearch(settings, window);
|
||||
}
|
||||
|
||||
m_compilerFlags = new QtProjectWizzardContentFlags(settings, window);
|
||||
}
|
||||
|
||||
QtProjectWizzardContentBuildFile* QtProjectWizzardContentSummary::contentBuildFile()
|
||||
void QtProjectWizzardContentSummary::addContent(QtProjectWizzardContent* content, bool advanced, bool gapBefore)
|
||||
{
|
||||
return m_buildFile;
|
||||
Element element;
|
||||
element.content = content;
|
||||
element.advanced = advanced;
|
||||
element.gapBefore = gapBefore;
|
||||
m_elements.push_back(element);
|
||||
}
|
||||
|
||||
QtProjectWizzardContentPathsSource* QtProjectWizzardContentSummary::contentPathsSource()
|
||||
void QtProjectWizzardContentSummary::setIsForm(bool isForm)
|
||||
{
|
||||
return m_source;
|
||||
m_isForm = isForm;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSummary::populateWindow(QGridLayout* layout)
|
||||
{
|
||||
int row = 0;
|
||||
|
||||
layout->setRowMinimumHeight(row, 10);
|
||||
row++;
|
||||
|
||||
m_data->populateForm(layout, row);
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
|
||||
int row2 = row;
|
||||
m_buildFile->populateForm(layout, row);
|
||||
if (row != row2)
|
||||
if (m_isForm)
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
populateForm(layout, row);
|
||||
return;
|
||||
}
|
||||
|
||||
m_source->populateForm(layout, row);
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
layout->setRowMinimumHeight(row++, 10);
|
||||
|
||||
m_simple->populateForm(layout, row);
|
||||
m_headerSearch->populateForm(layout, row);
|
||||
|
||||
if (m_frameworkSearch)
|
||||
for (const Element& element : m_elements)
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
m_frameworkSearch->populateForm(layout, row);
|
||||
if (element.advanced)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (element.gapBefore)
|
||||
{
|
||||
layout->setRowMinimumHeight(row++, 20);
|
||||
}
|
||||
|
||||
element.content->populateWindow(layout, row);
|
||||
}
|
||||
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
|
||||
QFrame* separator = new QFrame();
|
||||
separator->setFrameShape(QFrame::HLine);
|
||||
|
||||
QPalette palette = separator->palette();
|
||||
palette.setColor(QPalette::WindowText, Qt::lightGray);
|
||||
separator->setPalette(palette);
|
||||
|
||||
layout->addWidget(separator, row, 0, 1, -1);
|
||||
row++;
|
||||
|
||||
QLabel* advancedLabel = createFormLabel("ADVANCED");
|
||||
layout->addWidget(advancedLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
|
||||
row++;
|
||||
|
||||
m_compilerFlags->populateForm(layout, row);
|
||||
|
||||
layout->setRowMinimumHeight(row, 10);
|
||||
layout->setRowStretch(row, 1);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSummary::windowReady()
|
||||
void QtProjectWizzardContentSummary::populateForm(QGridLayout* layout, int& row)
|
||||
{
|
||||
m_window->updateTitle("NEW PROJECT - SUMMARY");
|
||||
m_window->updateNextButton("Create");
|
||||
layout->setRowMinimumHeight(row++, 10);
|
||||
|
||||
bool hasAdvanced = false;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
bool advanced = i > 0;
|
||||
|
||||
for (const Element& element : m_elements)
|
||||
{
|
||||
if (element.advanced != advanced)
|
||||
{
|
||||
hasAdvanced = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (element.gapBefore)
|
||||
{
|
||||
layout->setRowMinimumHeight(row++, 15);
|
||||
}
|
||||
|
||||
element.content->populateForm(layout, row);
|
||||
}
|
||||
|
||||
if (i > 0 || !hasAdvanced)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QFrame* separator = new QFrame();
|
||||
separator->setFrameShape(QFrame::HLine);
|
||||
|
||||
QPalette palette = separator->palette();
|
||||
palette.setColor(QPalette::WindowText, Qt::lightGray);
|
||||
separator->setPalette(palette);
|
||||
|
||||
layout->addWidget(separator, row++, 0, 1, -1);
|
||||
|
||||
QLabel* advancedLabel = createFormLabel("ADVANCED");
|
||||
layout->addWidget(advancedLabel, row++, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
|
||||
|
||||
layout->setRowMinimumHeight(row++, 15);
|
||||
}
|
||||
|
||||
layout->setRowMinimumHeight(row, 10);
|
||||
layout->setRowStretch(row, 1);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSummary::load()
|
||||
{
|
||||
m_data->load();
|
||||
m_buildFile->load();
|
||||
m_source->load();
|
||||
m_simple->load();
|
||||
m_headerSearch->load();
|
||||
|
||||
if (m_frameworkSearch)
|
||||
for (const Element& element : m_elements)
|
||||
{
|
||||
m_frameworkSearch->load();
|
||||
element.content->load();
|
||||
}
|
||||
|
||||
m_compilerFlags->load();
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSummary::save()
|
||||
{
|
||||
m_data->save();
|
||||
m_buildFile->save();
|
||||
m_source->save();
|
||||
m_simple->save();
|
||||
m_headerSearch->save();
|
||||
|
||||
if (m_frameworkSearch)
|
||||
for (const Element& element : m_elements)
|
||||
{
|
||||
m_frameworkSearch->save();
|
||||
element.content->save();
|
||||
}
|
||||
|
||||
m_compilerFlags->save();
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentSummary::check()
|
||||
{
|
||||
return
|
||||
m_data->check() &&
|
||||
m_buildFile->check() &&
|
||||
m_source->check() &&
|
||||
m_simple->check() &&
|
||||
m_headerSearch->check() &&
|
||||
(!m_frameworkSearch || m_frameworkSearch->check()) &&
|
||||
m_compilerFlags->check();
|
||||
for (const Element& element : m_elements)
|
||||
{
|
||||
if (!element.content->check())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentSummary::isScrollAble() const
|
||||
|
||||
@@ -2,25 +2,28 @@
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_SUMMARY_H
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentData.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentFlags.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
|
||||
|
||||
class QtProjectWizzardContentSummary
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
private:
|
||||
struct Element
|
||||
{
|
||||
QtProjectWizzardContent* content;
|
||||
bool advanced;
|
||||
bool gapBefore;
|
||||
};
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentSummary(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
QtProjectWizzardContentBuildFile* contentBuildFile();
|
||||
QtProjectWizzardContentPathsSource* contentPathsSource();
|
||||
void addContent(QtProjectWizzardContent* content, bool advanced, bool gapBefore);
|
||||
void setIsForm(bool isForm);
|
||||
|
||||
protected:
|
||||
// QtProjectContentWindow implementation
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populateWindow(QGridLayout* layout) override;
|
||||
virtual void windowReady() override;
|
||||
virtual void populateForm(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
@@ -29,13 +32,9 @@ protected:
|
||||
virtual bool isScrollAble() const override;
|
||||
|
||||
private:
|
||||
QtProjectWizzardContentData* m_data;
|
||||
QtProjectWizzardContentBuildFile* m_buildFile;
|
||||
QtProjectWizzardContentPathsSource* m_source;
|
||||
QtProjectWizzardContentSimple* m_simple;
|
||||
QtProjectWizzardContentPathsHeaderSearch* m_headerSearch;
|
||||
QtProjectWizzardContentPathsFrameworkSearch* m_frameworkSearch;
|
||||
QtProjectWizzardContentFlags* m_compilerFlags;
|
||||
std::vector<Element> m_elements;
|
||||
|
||||
bool m_isForm;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_SUMMARY_H
|
||||
|
||||
Reference in New Issue
Block a user