ui: Removed simple setup as distinct step from project setup and moved it to include paths

This commit is contained in:
Eberhard Graether
2016-04-24 23:58:48 +02:00
parent 6be207a68a
commit 6bca5d2964
6 changed files with 34 additions and 201 deletions
@@ -389,25 +389,7 @@ void QtProjectWizzard::selectedProjectType(QtProjectWizzardContentSelect::Projec
void QtProjectWizzard::emptyProject()
{
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentData>();
connect(window, SIGNAL(next()), this, SLOT(simpleSetup()));
}
void QtProjectWizzard::simpleSetup()
{
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentSimple>();
connect(window, SIGNAL(next()), this, SLOT(simpleSetupDone()));
}
void QtProjectWizzard::simpleSetupDone()
{
if (m_settings.getUseSourcePathsForHeaderSearch())
{
simpleSourcePaths();
}
else
{
sourcePaths();
}
connect(window, SIGNAL(next()), this, SLOT(sourcePaths()));
}
void QtProjectWizzard::sourcePaths()
@@ -425,31 +407,8 @@ void QtProjectWizzard::headerSearchPaths()
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()));
}
void QtProjectWizzard::simpleSourcePaths()
{
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentPathsSourceSimple>();
connect(window, SIGNAL(next()), this, SLOT(simpleHeaderSearchPaths()));
connectShowFiles(window->content());
}
void QtProjectWizzard::simpleHeaderSearchPaths()
{
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);
summary->addContent(new QtProjectWizzardContentSimple(settings, window), false, false);
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(settings, window), false, true);
window->setup();
}
@@ -75,15 +75,10 @@ private slots:
void selectedProjectType(QtProjectWizzardContentSelect::ProjectType type);
void emptyProject();
void simpleSetup();
void simpleSetupDone();
void sourcePaths();
void headerSearchPaths();
void simpleSourcePaths();
void simpleHeaderSearchPaths();
void headerSearchPathsDone();
void frameworkSearchPaths();
@@ -286,20 +286,6 @@ QStringList QtProjectWizzardContentPathsSource::getSourceFileNames(bool headersO
return list;
}
QtProjectWizzardContentPathsSourceSimple::QtProjectWizzardContentPathsSourceSimple(
ProjectSettings* settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPathsSource(settings, window)
{
m_showFilesString = "show files";
setTitleString("Project Paths");
setDescriptionString(
"Add all directories or files you want to analyse with Coati. It is sufficient to just provide the top level "
"project directory."
);
}
QtProjectWizzardContentPathsCDBHeader::QtProjectWizzardContentPathsCDBHeader(
ProjectSettings* settings, QtProjectWizzardWindow* window
)
@@ -339,9 +325,9 @@ QtProjectWizzardContentPathsHeaderSearch::QtProjectWizzardContentPathsHeaderSear
: QtProjectWizzardContentPaths(settings, window)
{
setInfo(
"Header Search Paths",
"Add the header search paths for resolving #include directives in the analyzed source and header files.",
"Header Search Paths define where additional headers, that your project depends on, are found. Usually they are "
"Include Paths",
"Add the paths for resolving #include directives in the analyzed source and header files.",
"Include Paths define where additional files, that your project depends on, are found. Usually they are "
"header files of frameworks or libraries that your project uses. These files won't be analyzed, but Coati needs "
"them for correct analysis."
);
@@ -362,32 +348,20 @@ bool QtProjectWizzardContentPathsHeaderSearch::isScrollAble() const
return true;
}
QtProjectWizzardContentPathsHeaderSearchSimple::QtProjectWizzardContentPathsHeaderSearchSimple(
ProjectSettings* settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPathsHeaderSearch(settings, window)
{
setTitleString("External Header Search Paths");
setDescriptionString(
"Add the header search paths to external dependencies used in your project. The header search paths are "
"needed to resolve #include directives within your source and header files."
);
}
QtProjectWizzardContentPathsHeaderSearchGlobal::QtProjectWizzardContentPathsHeaderSearchGlobal(
ProjectSettings* settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPaths(settings, window)
{
setInfo(
"Global Header Search Paths",
"These header search paths will be used in all your projects. Use it to add system header paths "
"Global Include Paths",
"These include paths will be used in all your projects. Use it to add system header paths "
"(See <a href=\"https://coati.io/documentation/#FindingSystemHeaderLocations\">Finding System Header Locations</a> "
"or use the auto detection below).",
"Header Search Paths define where additional headers, that your project depends on, are found. Usually they are "
"Include Paths define where additional files, that your project depends on, are found. Usually they are "
"header files of frameworks or libraries that your project uses. These files won't be analyzed, but Coati needs "
"them for correct analysis.\n\n"
"Header Search Paths defined here will be used for all projects."
"Include Paths defined here will be used for all projects."
);
m_detectionString = "headers";
@@ -74,13 +74,6 @@ protected:
QStringList getSourceFileNames(bool headersOnly) const;
};
class QtProjectWizzardContentPathsSourceSimple
: public QtProjectWizzardContentPathsSource
{
public:
QtProjectWizzardContentPathsSourceSimple(ProjectSettings* settings, QtProjectWizzardWindow* window);
};
class QtProjectWizzardContentPathsCDBHeader
: public QtProjectWizzardContentPathsSource
{
@@ -107,13 +100,6 @@ public:
virtual bool isScrollAble() const override;
};
class QtProjectWizzardContentPathsHeaderSearchSimple
: public QtProjectWizzardContentPathsHeaderSearch
{
public:
QtProjectWizzardContentPathsHeaderSearchSimple(ProjectSettings* settings, QtProjectWizzardWindow* window);
};
class QtProjectWizzardContentPathsHeaderSearchGlobal
: public QtProjectWizzardContentPaths
{
@@ -1,136 +1,61 @@
#include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h"
#include <QCheckBox>
#include <QButtonGroup>
#include <QVBoxLayout>
#include <QLabel>
#include <QMessageBox>
#include <QRadioButton>
QtProjectWizzardContentSimple::QtProjectWizzardContentSimple(ProjectSettings* settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContent(settings, window)
, m_buttons(nullptr)
, m_checkBox(nullptr)
, m_isForm(false)
{
}
void QtProjectWizzardContentSimple::populateWindow(QGridLayout* layout)
{
layout->setRowMinimumHeight(0, 10);
int row = 0;
populateWindow(layout, row);
}
QLabel* title = new QLabel("Simple Setup");
void QtProjectWizzardContentSimple::populateWindow(QGridLayout* layout, int& row)
{
QLabel* title = new QLabel("Lazy Include Search");
title->setWordWrap(true);
title->setObjectName("section");
layout->addWidget(title, 1, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop | Qt::AlignRight);
layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
layout->setRowStretch(row, 0);
QLabel* text = new QLabel(
"In simple setup you just provide the directory of your project and Coati will find all source files and "
"resolve header search paths within. Please note that simple setup slows down the analysis.\n\n"
"In the advanced setup you define analyzed source files and the corresponding header search paths separately."
);
QLabel* text = new QLabel("Search for included files in all subdirectories of the project paths. "
"Warning: This slows down analysis speed.");
text->setWordWrap(true);
layout->addWidget(text, 1, QtProjectWizzardWindow::BACK_COL);
layout->addWidget(text, row + 1, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
layout->setRowStretch(row + 1, 1);
QRadioButton* a = new QRadioButton("simple setup");
QRadioButton* b = new QRadioButton("advanced setup");
m_checkBox = new QCheckBox("Search included files within the project paths");
layout->addWidget(m_checkBox, row, QtProjectWizzardWindow::BACK_COL);
m_buttons = new QButtonGroup(this);
m_buttons->addButton(a);
m_buttons->addButton(b);
m_buttons->setId(a, 0);
m_buttons->setId(b, 1);
connect(m_buttons, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),
[this](int id)
{
m_window->setNextEnabled(true);
}
);
QVBoxLayout* vlayout = new QVBoxLayout();
vlayout->addWidget(a);
vlayout->addWidget(b);
vlayout->addStretch();
layout->addLayout(vlayout, 2, QtProjectWizzardWindow::BACK_COL);
layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1);
layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 3);
row += 2;
}
void QtProjectWizzardContentSimple::populateForm(QGridLayout* layout, int& row)
{
QLabel* label = createFormLabel("Simple Setup");
QLabel* label = createFormLabel("Lazy Include Search");
layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL);
m_checkBox = new QCheckBox("Search headers in project paths");
m_checkBox = new QCheckBox("Search included files within the project paths");
layout->addWidget(m_checkBox, row, QtProjectWizzardWindow::BACK_COL);
// addHelpButton("help message", layout, row);
addHelpButton("Check this box to search for included files in all subdirectories of the project paths. "
"This avoids setting them manually if you are not familiar with the project you want to analyse.\n"
"Warning: This option slows down analysis speed.", layout, row);
m_isForm = true;
row++;
}
void QtProjectWizzardContentSimple::windowReady()
{
if (!m_isForm)
{
m_window->setNextEnabled(false);
}
}
void QtProjectWizzardContentSimple::load()
{
if (m_isForm && m_checkBox)
{
m_checkBox->setChecked(m_settings->getUseSourcePathsForHeaderSearch());
}
else if (m_buttons && m_settings->isUseSourcePathsForHeaderSearchDefined())
{
m_buttons->button(m_settings->getUseSourcePathsForHeaderSearch() ? 0 : 1)->setChecked(true);
m_window->setNextEnabled(true);
}
m_checkBox->setChecked(m_settings->getUseSourcePathsForHeaderSearch());
}
void QtProjectWizzardContentSimple::save()
{
bool simpleSetup;
if (m_isForm)
{
simpleSetup = m_checkBox->isChecked();
}
else
{
switch (m_buttons->checkedId())
{
case 0: simpleSetup = true; break;
case 1: simpleSetup = false; break;
default: return;
}
}
m_settings->setUseSourcePathsForHeaderSearch(simpleSetup);
}
bool QtProjectWizzardContentSimple::check()
{
if (!m_isForm && m_buttons->checkedId() == -1)
{
QMessageBox msgBox;
msgBox.setText("Please choose if you want simple or advanced setup.");
msgBox.exec();
return false;
}
return true;
}
QSize QtProjectWizzardContentSimple::preferredWindowSize() const
{
return QSize(650, 350);
m_settings->setUseSourcePathsForHeaderSearch(m_checkBox->isChecked());
}
@@ -16,20 +16,14 @@ public:
// QtProjectWizzardContent implementation
virtual void populateWindow(QGridLayout* layout) override;
virtual void populateWindow(QGridLayout* layout, int& row) override;
virtual void populateForm(QGridLayout* layout, int& row) override;
virtual void windowReady() override;
virtual void load() override;
virtual void save() override;
virtual bool check() override;
virtual QSize preferredWindowSize() const override;
private:
QButtonGroup* m_buttons;
QCheckBox* m_checkBox;
bool m_isForm;
};
#endif // QT_PROJECT_WIZZARD_CONTENT_SIMPLE_H