ui: Revised project setup

* changed help texts
* use help buttons instead of descriptions in dialogs
* fixed show files button not up-to-date with directory list box
* fixed source file extensions shown in cdb setup
* refactored size and content setting for project content classes
This commit is contained in:
Eberhard Graether
2016-08-30 11:20:32 +02:00
parent d4131ce92c
commit ebdc2d3382
31 changed files with 202 additions and 320 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ QLabel, QCheckBox {
font-weight: bold; font-weight: bold;
} }
#section, #projectTitle { #projectTitle {
font-size: 14pt; font-size: 14pt;
font-weight: bold; font-weight: bold;
} }
@@ -270,7 +270,7 @@ std::string SolutionParserVisualStudio::getButtonText() const
std::string SolutionParserVisualStudio::getDescription() const std::string SolutionParserVisualStudio::getDescription() const
{ {
return "Create a new project from an existing Visual Studio Solution file."; return "Create a new project from an existing Visual Studio Solution file. <b>Unstable!</b>";
} }
std::string SolutionParserVisualStudio::getIconPath() const std::string SolutionParserVisualStudio::getIconPath() const
@@ -134,12 +134,14 @@ QtDirectoryListBox::QtDirectoryListBox(QWidget *parent, const QString& listName,
m_addButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_addButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_addButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac m_addButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
m_addButton->setObjectName("plusButton"); m_addButton->setObjectName("plusButton");
m_addButton->setToolTip("add line");
innerLayout->addWidget(m_addButton); innerLayout->addWidget(m_addButton);
m_removeButton = new QPushButton("", this); m_removeButton = new QPushButton("", this);
m_removeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_removeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_removeButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac m_removeButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
m_removeButton->setObjectName("minusButton"); m_removeButton->setObjectName("minusButton");
m_removeButton->setToolTip("remove line");
innerLayout->addWidget(m_removeButton); innerLayout->addWidget(m_removeButton);
innerLayout->addStretch(); innerLayout->addStretch();
@@ -154,6 +156,7 @@ QtDirectoryListBox::QtDirectoryListBox(QWidget *parent, const QString& listName,
editButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); editButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
editButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac editButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
editButton->setObjectName("editButton"); editButton->setObjectName("editButton");
editButton->setToolTip("edit plain text");
innerLayout->addWidget(editButton); innerLayout->addWidget(editButton);
if (isForStrings()) if (isForStrings())
@@ -24,6 +24,7 @@ QtLocationPicker::QtLocationPicker(QWidget *parent)
m_button = new QPushButton(""); m_button = new QPushButton("");
m_button->setObjectName("dotsButton"); m_button->setObjectName("dotsButton");
m_button->setToolTip("pick file");
m_button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac m_button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
connect(m_button, SIGNAL(clicked()), this, SLOT(handleButtonPress())); connect(m_button, SIGNAL(clicked()), this, SLOT(handleButtonPress()));
layout->addWidget(m_button); layout->addWidget(m_button);
+10 -1
View File
@@ -30,6 +30,15 @@ std::string QtTextEditDialog::getText()
void QtTextEditDialog::setReadOnly(bool readOnly) void QtTextEditDialog::setReadOnly(bool readOnly)
{ {
m_text->setReadOnly(readOnly); m_text->setReadOnly(readOnly);
if (readOnly)
{
updateNextButton("OK");
}
else
{
updateNextButton("Save");
}
} }
void QtTextEditDialog::populateWindow(QWidget* widget) void QtTextEditDialog::populateWindow(QWidget* widget)
@@ -51,7 +60,7 @@ void QtTextEditDialog::populateWindow(QWidget* widget)
void QtTextEditDialog::windowReady() void QtTextEditDialog::windowReady()
{ {
updateNextButton("Ok"); updateNextButton("Save");
updateCloseButton("Cancel"); updateCloseButton("Cancel");
setPreviousVisible(false); setPreviousVisible(false);
@@ -237,6 +237,7 @@ QtProjectWizzardWindow* QtProjectWizzard::createWindowWithContent()
connect(window, SIGNAL(canceled()), this, SLOT(cancelWizzard())); connect(window, SIGNAL(canceled()), this, SLOT(cancelWizzard()));
window->setContent(new T(m_settings, window)); window->setContent(new T(m_settings, window));
window->setPreferredSize(QSize(580, 340));
window->setup(); window->setup();
m_windowStack.pushWindow(window); m_windowStack.pushWindow(window);
@@ -255,6 +256,7 @@ QtProjectWizzardWindow* QtProjectWizzard::createWindowWithContent<QtProjectWizza
QtProjectWizzardContentSelect* content = new QtProjectWizzardContentSelect(m_settings, window, m_parserManager); QtProjectWizzardContentSelect* content = new QtProjectWizzardContentSelect(m_settings, window, m_parserManager);
window->setContent(content); window->setContent(content);
window->setPreferredSize(QSize(570, 380));
window->setup(); window->setup();
m_windowStack.pushWindow(window); m_windowStack.pushWindow(window);
@@ -273,6 +275,7 @@ QtProjectWizzardWindow* QtProjectWizzard::createWindowWithSummary(
QtProjectWizzardContentSummary* summary = new QtProjectWizzardContentSummary(m_settings, window); QtProjectWizzardContentSummary* summary = new QtProjectWizzardContentSummary(m_settings, window);
window->setContent(summary); window->setContent(summary);
window->setPreferredSize(QSize(750, 500));
func(window, summary); func(window, summary);
m_windowStack.pushWindow(window); m_windowStack.pushWindow(window);
@@ -373,7 +376,7 @@ void QtProjectWizzard::sourcePaths()
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary) [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{ {
summary->addContent(new QtProjectWizzardContentPathsSource(m_settings, window), false, false); summary->addContent(new QtProjectWizzardContentPathsSource(m_settings, window), false, false);
summary->addContent(new QtProjectWizzardContentExtensions(m_settings, window), false, false); summary->addContent(new QtProjectWizzardContentExtensions(m_settings, window), false, true);
window->setup(); window->setup();
} }
@@ -388,7 +391,7 @@ void QtProjectWizzard::headerSearchPaths()
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary) [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{ {
summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(m_settings, window), false, false); summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(m_settings, window), false, false);
summary->addContent(new QtProjectWizzardContentSimple(m_settings, window), false, false); summary->addContent(new QtProjectWizzardContentSimple(m_settings, window), false, true);
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(m_settings, window), false, true); summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(m_settings, window), false, true);
window->setup(); window->setup();
@@ -416,7 +419,7 @@ void QtProjectWizzard::frameworkSearchPaths()
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary) [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{ {
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_settings, window), false, false); summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_settings, window), false, false);
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(m_settings, window), false, false); summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(m_settings, window), false, true);
window->setup(); window->setup();
} }
@@ -429,8 +432,6 @@ void QtProjectWizzard::emptyProjectCDB()
{ {
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentDataCDB>(); QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentDataCDB>();
window->updateTitle("NEW PROJECT FROM COMPILATION DATABASE");
connect(window, SIGNAL(next()), this, SLOT(headerPathsCDB())); connect(window, SIGNAL(next()), this, SLOT(headerPathsCDB()));
} }
@@ -440,31 +441,13 @@ void QtProjectWizzard::headerPathsCDB()
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary) [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{ {
summary->addContent(new QtProjectWizzardContentCDBSource(m_settings, window), false, false); summary->addContent(new QtProjectWizzardContentCDBSource(m_settings, window), false, false);
summary->addContent(new QtProjectWizzardContentPathsCDBHeader(m_settings, window), false, false); summary->addContent(new QtProjectWizzardContentPathsCDBHeader(m_settings, window), false, true);
window->setup(); window->setup();
window->updateTitle("NEW PROJECT FROM COMPILATION DATABASE");
} }
); );
connect(window, SIGNAL(next()), this, SLOT(headerPathsCDBDone())); connect(window, SIGNAL(next()), this, SLOT(showSummary()));
}
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::sourcePathsJava() void QtProjectWizzard::sourcePathsJava()
@@ -473,7 +456,7 @@ void QtProjectWizzard::sourcePathsJava()
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary) [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{ {
summary->addContent(new QtProjectWizzardContentPathsSourceJava(m_settings, window), false, false); summary->addContent(new QtProjectWizzardContentPathsSourceJava(m_settings, window), false, false);
summary->addContent(new QtProjectWizzardContentPathsClassJava(m_settings, window), false, false); summary->addContent(new QtProjectWizzardContentPathsClassJava(m_settings, window), false, true);
window->setup(); window->setup();
} }
@@ -514,6 +497,10 @@ void QtProjectWizzard::showSummary()
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_settings, window), false, true); summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_settings, window), false, true);
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(m_settings, window), false, false); summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(m_settings, window), false, false);
} }
summary->addContent(new QtProjectWizzardContentExtensions(m_settings, window), true, false);
summary->addContent(new QtProjectWizzardContentFlags(m_settings, window), true, true);
summary->addContent(new QtProjectWizzardContentPathsExclude(m_settings, window), true, true);
} }
else else
{ {
@@ -522,19 +509,18 @@ void QtProjectWizzard::showSummary()
QtProjectWizzardContent* headers = new QtProjectWizzardContentPathsCDBHeader(m_settings, window); QtProjectWizzardContent* headers = new QtProjectWizzardContentPathsCDBHeader(m_settings, window);
summary->addContent(headers, false, true); summary->addContent(headers, false, true);
summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(m_settings, window), true, false); summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(m_settings, window, true), false, true);
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(m_settings, window), false, true); summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(m_settings, window), false, false);
if (QSysInfo::macVersion() != QSysInfo::MV_None) if (QSysInfo::macVersion() != QSysInfo::MV_None)
{ {
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_settings, window), true, false); summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_settings, window, true), false, true);
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(m_settings, window), false, false); summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(m_settings, window), false, false);
} }
}
summary->addContent(new QtProjectWizzardContentExtensions(m_settings, window), true, true); summary->addContent(new QtProjectWizzardContentFlags(m_settings, window), true, false);
summary->addContent(new QtProjectWizzardContentFlags(m_settings, window), true, true);
summary->addContent(new QtProjectWizzardContentPathsExclude(m_settings, window), true, true); summary->addContent(new QtProjectWizzardContentPathsExclude(m_settings, window), true, true);
}
window->setup(); window->setup();
@@ -74,7 +74,6 @@ private slots:
void emptyProjectCDB(); void emptyProjectCDB();
void headerPathsCDB(); void headerPathsCDB();
void headerPathsCDBDone();
void sourcePathsJava(); void sourcePathsJava();
@@ -12,6 +12,7 @@ QtHelpButton::QtHelpButton(const QString& helpText, QWidget* parent)
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
setObjectName("helpButton"); setObjectName("helpButton");
setToolTip("help");
connect(this, SIGNAL(clicked()), this, SLOT(handleHelpPress())); connect(this, SIGNAL(clicked()), this, SLOT(handleHelpPress()));
} }
@@ -31,14 +32,11 @@ QtProjectWizzardContent::QtProjectWizzardContent(std::shared_ptr<ProjectSettings
: QWidget(window) : QWidget(window)
, m_settings(settings) , m_settings(settings)
, m_window(window) , m_window(window)
, m_isInForm(false)
{ {
} }
void QtProjectWizzardContent::populateWindow(QGridLayout* layout, int& row) void QtProjectWizzardContent::populate(QGridLayout* layout, int& row)
{
}
void QtProjectWizzardContent::populateForm(QGridLayout* layout, int& row)
{ {
} }
@@ -64,11 +62,6 @@ bool QtProjectWizzardContent::isScrollAble() const
return false; return false;
} }
QSize QtProjectWizzardContent::preferredWindowSize() const
{
return QSize(750, 620);
}
std::vector<std::string> QtProjectWizzardContent::getFileNames() const std::vector<std::string> QtProjectWizzardContent::getFileNames() const
{ {
return std::vector<std::string>(); return std::vector<std::string>();
@@ -84,6 +77,16 @@ QString QtProjectWizzardContent::getFileNamesDescription() const
return "files"; return "files";
} }
bool QtProjectWizzardContent::isInForm() const
{
return m_isInForm;
}
void QtProjectWizzardContent::setIsInForm(bool isInForm)
{
m_isInForm = isInForm;
}
QLabel* QtProjectWizzardContent::createFormLabel(QString name) const QLabel* QtProjectWizzardContent::createFormLabel(QString name) const
{ {
QLabel* label = new QLabel(name); QLabel* label = new QLabel(name);
@@ -132,6 +135,8 @@ QPushButton* QtProjectWizzardContent::addFilesButton(QString name, QGridLayout*
void QtProjectWizzardContent::filesButtonClicked() void QtProjectWizzardContent::filesButtonClicked()
{ {
save();
if (!m_filesDialog) if (!m_filesDialog)
{ {
std::vector<std::string> fileNames = getFileNames(); std::vector<std::string> fileNames = getFileNames();
@@ -36,8 +36,7 @@ class QtProjectWizzardContent
public: public:
QtProjectWizzardContent(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window); QtProjectWizzardContent(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
virtual void populateWindow(QGridLayout* layout, int& row); virtual void populate(QGridLayout* layout, int& row);
virtual void populateForm(QGridLayout* layout, int& row);
virtual void windowReady(); virtual void windowReady();
virtual void load(); virtual void load();
@@ -46,12 +45,13 @@ public:
virtual bool isScrollAble() const; virtual bool isScrollAble() const;
virtual QSize preferredWindowSize() const;
virtual std::vector<std::string> getFileNames() const; virtual std::vector<std::string> getFileNames() const;
virtual QString getFileNamesTitle() const; virtual QString getFileNamesTitle() const;
virtual QString getFileNamesDescription() const; virtual QString getFileNamesDescription() const;
bool isInForm() const;
void setIsInForm(bool isInForm);
protected: protected:
QLabel* createFormLabel(QString name) const; QLabel* createFormLabel(QString name) const;
QLabel* createFormTitle(QString name) const; QLabel* createFormTitle(QString name) const;
@@ -69,6 +69,8 @@ private slots:
private: private:
std::shared_ptr<QtTextEditDialog> m_filesDialog; std::shared_ptr<QtTextEditDialog> m_filesDialog;
bool m_isInForm;
}; };
#endif // QT_PROJECT_WIZZARD_CONTENT_H #endif // QT_PROJECT_WIZZARD_CONTENT_H
@@ -31,7 +31,7 @@ QtProjectWizzardContentSelect::ProjectType QtProjectWizzardContentBuildFile::get
return m_type; return m_type;
} }
void QtProjectWizzardContentBuildFile::populateForm(QGridLayout* layout, int& row) void QtProjectWizzardContentBuildFile::populate(QGridLayout* layout, int& row)
{ {
QString name; QString name;
QString filter; QString filter;
@@ -21,7 +21,7 @@ public:
QtProjectWizzardContentSelect::ProjectType getType() const; QtProjectWizzardContentSelect::ProjectType getType() const;
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void populateForm(QGridLayout* layout, int& row) override; virtual void populate(QGridLayout* layout, int& row) override;
virtual void load() override; virtual void load() override;
virtual void save() override; virtual void save() override;
@@ -11,13 +11,9 @@ QtProjectWizzardContentCDBSource::QtProjectWizzardContentCDBSource(
{ {
} }
void QtProjectWizzardContentCDBSource::populateWindow(QGridLayout* layout, int& row) void QtProjectWizzardContentCDBSource::populate(QGridLayout* layout, int& row)
{ {
layout->setRowMinimumHeight(row++, 10); QLabel* title = createFormLabel("Source Files");
QLabel* title = new QLabel("Source Files");
title->setWordWrap(true);
title->setObjectName("section");
layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
layout->setRowStretch(row, 0); layout->setRowStretch(row, 0);
@@ -27,9 +23,6 @@ void QtProjectWizzardContentCDBSource::populateWindow(QGridLayout* layout, int&
addFilesButton("show source files", layout, row + 1); addFilesButton("show source files", layout, row + 1);
row += 2; row += 2;
layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1);
layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 2);
} }
void QtProjectWizzardContentCDBSource::load() void QtProjectWizzardContentCDBSource::load()
@@ -12,7 +12,7 @@ public:
QtProjectWizzardContentCDBSource(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window); QtProjectWizzardContentCDBSource(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void populateWindow(QGridLayout* layout, int& row) override; virtual void populate(QGridLayout* layout, int& row) override;
virtual void load() override; virtual void load() override;
@@ -17,24 +17,28 @@ QtProjectWizzardContentData::QtProjectWizzardContentData(std::shared_ptr<Project
{ {
} }
void QtProjectWizzardContentData::populateWindow(QGridLayout* layout, int& row) void QtProjectWizzardContentData::populate(QGridLayout* layout, int& row)
{
if (!isInForm())
{ {
layout->setRowMinimumHeight(0, 15); layout->setRowMinimumHeight(0, 15);
row++; row++;
populateForm(layout, row);
layout->setRowMinimumHeight(row, 15);
layout->setRowStretch(row, 1);
layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1);
layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 3);
} }
void QtProjectWizzardContentData::populateForm(QGridLayout* layout, int& row)
{
addNameAndLocation(layout, row); addNameAndLocation(layout, row);
if (!isInForm())
{
layout->setRowMinimumHeight(row++, 20);
}
addLanguageAndStandard(layout, row); addLanguageAndStandard(layout, row);
if (!isInForm())
{
layout->setRowMinimumHeight(row, 15);
layout->setRowStretch(row, 1);
}
} }
void QtProjectWizzardContentData::load() void QtProjectWizzardContentData::load()
@@ -116,14 +120,9 @@ bool QtProjectWizzardContentData::check()
return true; return true;
} }
QSize QtProjectWizzardContentData::preferredWindowSize() const
{
return QSize(580, 340);
}
void QtProjectWizzardContentData::addNameAndLocation(QGridLayout* layout, int& row) void QtProjectWizzardContentData::addNameAndLocation(QGridLayout* layout, int& row)
{ {
QLabel* nameLabel = createFormLabel("Name"); QLabel* nameLabel = createFormLabel("Project Name");
m_projectName = new QLineEdit(); m_projectName = new QLineEdit();
m_projectName->setObjectName("name"); m_projectName->setObjectName("name");
m_projectName->setAttribute(Qt::WA_MacShowFocusRect, 0); m_projectName->setAttribute(Qt::WA_MacShowFocusRect, 0);
@@ -133,7 +132,7 @@ void QtProjectWizzardContentData::addNameAndLocation(QGridLayout* layout, int& r
row++; row++;
QLabel* locationLabel = createFormLabel("Location"); QLabel* locationLabel = createFormLabel("Project File Location");
m_projectFileLocation = new QtLocationPicker(this); m_projectFileLocation = new QtLocationPicker(this);
m_projectFileLocation->setPickDirectory(true); m_projectFileLocation->setPickDirectory(true);
@@ -144,21 +143,14 @@ void QtProjectWizzardContentData::addNameAndLocation(QGridLayout* layout, int& r
void QtProjectWizzardContentData::addLanguageAndStandard(QGridLayout* layout, int& row) void QtProjectWizzardContentData::addLanguageAndStandard(QGridLayout* layout, int& row)
{ {
QLabel* languageLabel = new QLabel("Language");
languageLabel->setObjectName("label");
m_language = new QLabel(); m_language = new QLabel();
layout->addWidget(createFormLabel("Language"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
layout->addWidget(languageLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
layout->addWidget(m_language, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft); layout->addWidget(m_language, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
row++; row++;
QLabel* standardLabel = createFormLabel("Standard");
m_standard = new QComboBox(); m_standard = new QComboBox();
layout->addWidget(createFormLabel("Standard"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
layout->addWidget(standardLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
layout->addWidget(m_standard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft); layout->addWidget(m_standard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
row++; row++;
} }
@@ -176,7 +168,8 @@ void QtProjectWizzardContentData::addBuildFilePicker(
row++; row++;
QLabel* description = new QLabel( QLabel* description = new QLabel(
"The project will stay up-to-date with changes in the compilation database on refresh.", this); "Coati will use all include paths and compiler flags from the compilation database and stay up-to-date "
"with changes on refresh.", this);
description->setObjectName("description"); description->setObjectName("description");
description->setWordWrap(true); description->setWordWrap(true);
layout->addWidget(description, row, QtProjectWizzardWindow::BACK_COL); layout->addWidget(description, row, QtProjectWizzardWindow::BACK_COL);
@@ -191,16 +184,27 @@ QtProjectWizzardContentDataCDB::QtProjectWizzardContentDataCDB(
{ {
} }
void QtProjectWizzardContentDataCDB::populateForm(QGridLayout* layout, int& row) void QtProjectWizzardContentDataCDB::populate(QGridLayout* layout, int& row)
{ {
QString name = "Compilation Database"; if (!isInForm())
QString filter = "JSON Compilation Database (*.json)"; {
layout->setRowMinimumHeight(0, 15);
row++;
}
addNameAndLocation(layout, row); addNameAndLocation(layout, row);
layout->setRowMinimumHeight(row++, 20); layout->setRowMinimumHeight(row++, 20);
QString name = "Compilation Database (compile_commands.json)";
QString filter = "JSON Compilation Database (*.json)";
addBuildFilePicker(layout, row, name, filter); addBuildFilePicker(layout, row, name, filter);
if (!isInForm())
{
layout->setRowMinimumHeight(row, 15);
layout->setRowStretch(row, 1);
}
} }
void QtProjectWizzardContentDataCDB::load() void QtProjectWizzardContentDataCDB::load()
@@ -16,15 +16,12 @@ public:
QtProjectWizzardContentData(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window); QtProjectWizzardContentData(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void populateWindow(QGridLayout* layout, int& row) override; virtual void populate(QGridLayout* layout, int& row) override;
virtual void populateForm(QGridLayout* layout, int& row) override;
virtual void load() override; virtual void load() override;
virtual void save() override; virtual void save() override;
virtual bool check() override; virtual bool check() override;
virtual QSize preferredWindowSize() const override;
protected: protected:
virtual void addNameAndLocation(QGridLayout* layout, int& row); virtual void addNameAndLocation(QGridLayout* layout, int& row);
virtual void addLanguageAndStandard(QGridLayout* layout, int& row); virtual void addLanguageAndStandard(QGridLayout* layout, int& row);
@@ -48,7 +45,7 @@ class QtProjectWizzardContentDataCDB
public: public:
QtProjectWizzardContentDataCDB(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window); QtProjectWizzardContentDataCDB(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
virtual void populateForm(QGridLayout* layout, int& row) override; virtual void populate(QGridLayout* layout, int& row) override;
virtual void load() override; virtual void load() override;
virtual void save() override; virtual void save() override;
@@ -11,28 +11,7 @@ QtProjectWizzardContentExtensions::QtProjectWizzardContentExtensions(
{ {
} }
void QtProjectWizzardContentExtensions::populateWindow(QGridLayout* layout, int& row) void QtProjectWizzardContentExtensions::populate(QGridLayout* layout, int& row)
{
layout->setRowMinimumHeight(row++, 20);
QLabel* title = new QLabel("Source File Extensions");
title->setWordWrap(true);
title->setObjectName("section");
layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
layout->setRowStretch(row, 0);
QLabel* text = new QLabel("Define extensions for source files including the dot e.g. .cpp");
text->setWordWrap(true);
text->setOpenExternalLinks(true);
layout->addWidget(text, row + 1, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
layout->setRowStretch(row + 1, 1);
m_sourceList = new QtDirectoryListBox(this, title->text());
layout->addWidget(m_sourceList, row, QtProjectWizzardWindow::BACK_COL, 2, 1, Qt::AlignTop);
row += 2;
}
void QtProjectWizzardContentExtensions::populateForm(QGridLayout* layout, int& row)
{ {
QLabel* sourceLabel = createFormLabel("Source File Extensions"); QLabel* sourceLabel = createFormLabel("Source File Extensions");
sourceLabel->setObjectName("label"); sourceLabel->setObjectName("label");
@@ -14,8 +14,7 @@ public:
QtProjectWizzardContentExtensions(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window); QtProjectWizzardContentExtensions(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void populateWindow(QGridLayout* layout, int& row) override; virtual void populate(QGridLayout* layout, int& row) override;
virtual void populateForm(QGridLayout* layout, int& row) override;
virtual void load() override; virtual void load() override;
virtual void save() override; virtual void save() override;
@@ -10,7 +10,7 @@ QtProjectWizzardContentFlags::QtProjectWizzardContentFlags(std::shared_ptr<Proje
{ {
} }
void QtProjectWizzardContentFlags::populateForm(QGridLayout* layout, int& row) void QtProjectWizzardContentFlags::populate(QGridLayout* layout, int& row)
{ {
QLabel* label = createFormLabel("Compiler Flags"); QLabel* label = createFormLabel("Compiler Flags");
label->setObjectName("label"); label->setObjectName("label");
@@ -14,7 +14,7 @@ public:
QtProjectWizzardContentFlags(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window); QtProjectWizzardContentFlags(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void populateForm(QGridLayout* layout, int& row) override; virtual void populate(QGridLayout* layout, int& row) override;
virtual void load() override; virtual void load() override;
virtual void save() override; virtual void save() override;
@@ -20,45 +20,7 @@ QtProjectWizzardContentPaths::QtProjectWizzardContentPaths(std::shared_ptr<Proje
{ {
} }
void QtProjectWizzardContentPaths::populateWindow(QGridLayout* layout, int& row) void QtProjectWizzardContentPaths::populate(QGridLayout* layout, int& row)
{
layout->setRowMinimumHeight(row++, 10);
QLabel* title = new QLabel(m_titleString);
title->setWordWrap(true);
title->setObjectName("section");
layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
layout->setRowStretch(row, 0);
QLabel* text = new QLabel(m_descriptionString);
text->setWordWrap(true);
text->setOpenExternalLinks(true);
layout->addWidget(text, row + 1, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
layout->setRowStretch(row + 1, 1);
m_list = new QtDirectoryListBox(this, m_titleString);
layout->addWidget(m_list, row, QtProjectWizzardWindow::BACK_COL, 2, 1, Qt::AlignTop);
row += 2;
if (m_showFilesString.size() > 0)
{
layout->setRowStretch(row, 0);
addFilesButton(m_showFilesString, layout, row);
}
if (m_pathDetector)
{
addDetection(layout, row);
}
row++;
layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1);
layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 2);
}
void QtProjectWizzardContentPaths::populateForm(QGridLayout* layout, int& row)
{ {
QLabel* label = createFormLabel(m_titleString); QLabel* label = createFormLabel(m_titleString);
layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
@@ -85,11 +47,6 @@ void QtProjectWizzardContentPaths::populateForm(QGridLayout* layout, int& row)
} }
} }
QSize QtProjectWizzardContentPaths::preferredWindowSize() const
{
return QSize(750, 500);
}
bool QtProjectWizzardContentPaths::check() bool QtProjectWizzardContentPaths::check()
{ {
QString missingPaths; QString missingPaths;
@@ -120,23 +77,11 @@ bool QtProjectWizzardContentPaths::check()
return true; return true;
} }
void QtProjectWizzardContentPaths::setInfo(const QString& title, const QString& description, const QString& help)
{
m_titleString = title;
m_descriptionString = description;
m_helpString = help;
}
void QtProjectWizzardContentPaths::setTitleString(const QString& title) void QtProjectWizzardContentPaths::setTitleString(const QString& title)
{ {
m_titleString = title; m_titleString = title;
} }
void QtProjectWizzardContentPaths::setDescriptionString(const QString& description)
{
m_descriptionString = description;
}
void QtProjectWizzardContentPaths::setHelpString(const QString& help) void QtProjectWizzardContentPaths::setHelpString(const QString& help)
{ {
m_helpString = help; m_helpString = help;
@@ -190,20 +135,13 @@ QtProjectWizzardContentPathsSource::QtProjectWizzardContentPathsSource(
{ {
m_showFilesString = "show files"; m_showFilesString = "show files";
setInfo( setTitleString("Project Paths");
"Project Paths", setHelpString(
"Add all directories or files you want to index. Usually these are all source and header files of " "Project Paths define the files and directories that will be indexed by Coati. Provide a directory to recursively "
"your project or a subset of them.", "add all contained files.\n\nProject Paths are usually the source and header files of your project or a subset of them."
"Project Paths define the files and directories that will be indexed by Coati. Usually these are the "
"source and header files of your project or a subset of them."
); );
} }
QSize QtProjectWizzardContentPathsSource::preferredWindowSize() const
{
return QSize(750, 400);
}
void QtProjectWizzardContentPathsSource::load() void QtProjectWizzardContentPathsSource::load()
{ {
m_list->setList(m_settings->getSourcePaths()); m_list->setList(m_settings->getSourcePaths());
@@ -269,12 +207,11 @@ QtProjectWizzardContentPathsSourceJava::QtProjectWizzardContentPathsSourceJava(
) )
: QtProjectWizzardContentPathsSource(settings, window) : QtProjectWizzardContentPathsSource(settings, window)
{ {
setInfo( setHelpString(
"Source Paths", "Project Paths define the files and directories that will be indexed by Coati. Provide a directory to recursively "
"Add all directories or files you want to index. Usually these are all source files of " "add all contained files. Adding the root source directory of your project is usually sufficient.\n\n"
"your project or a subset of them.", "If your project's source code resides in one location, but generated source files are kept at a different location, "
"Source Paths define the files and directories that will be indexed by Coati. Usually these are the " "you will also need to add that directory."
"source files of your project or a subset of them."
); );
} }
@@ -285,14 +222,12 @@ QtProjectWizzardContentPathsCDBHeader::QtProjectWizzardContentPathsCDBHeader(
{ {
m_showFilesString = ""; m_showFilesString = "";
setTitleString("Header Paths"); setTitleString("Indexed Header Paths");
setDescriptionString(
"Where are the header files of the source files? Add the directories or files that should be "
"indexed if included by one of the source files."
);
setHelpString( setHelpString(
"The compilation database only contains source files. Add the header files or directories containing the header " "Define which header files should be indexed by Coati. Provide a directory to recursively add all contained files. "
"files here. Header files will be indexed if included." "Every time an included header is encountered, Coati will check if the file is located in one of these paths to "
"decide whether or not to index it.\n\n"
"This is necessary since the Compilation Database only specifies the source files of your project."
); );
} }
@@ -302,11 +237,8 @@ QtProjectWizzardContentPathsExclude::QtProjectWizzardContentPathsExclude(
) )
: QtProjectWizzardContentPaths(settings, window) : QtProjectWizzardContentPaths(settings, window)
{ {
setInfo( setTitleString("Exclude Paths");
"Exclude Paths", setHelpString("Exclude Paths define the files and directories that will be left out from indexing.");
"Add all directories or files you want to exclude from indexing.",
"Exclude Paths define the files and directories that will be left out from indexing."
);
} }
void QtProjectWizzardContentPathsExclude::load() void QtProjectWizzardContentPathsExclude::load()
@@ -321,16 +253,18 @@ void QtProjectWizzardContentPathsExclude::save()
QtProjectWizzardContentPathsHeaderSearch::QtProjectWizzardContentPathsHeaderSearch( QtProjectWizzardContentPathsHeaderSearch::QtProjectWizzardContentPathsHeaderSearch(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, bool isCDB
) )
: QtProjectWizzardContentPaths(settings, window) : QtProjectWizzardContentPaths(settings, window)
{ {
setInfo( setTitleString(isCDB ? "Additional Include Paths" : "Include Paths");
"Include Paths", setHelpString(
"Add the paths for resolving #include directives in the indexed source and header files.", "Include Paths are used for resolving #include directives in the indexed source and header files. These paths are "
"Include Paths define where additional files, that your project depends on, are found. Usually they are " "usually passed to the compiler with the '-I' or '-iquote' flags.\n\n"
"header files of frameworks or libraries that your project uses. These files won't be indexed, but Coati needs " "Add all the paths the #include directives throughout your project are relative to. If all #include directives are "
"them for correct indexing." "specified relative to the project's root directory, please add that.\n\n"
"If your project also includes files from external libraries (e.g. boost), please add these directories as well "
"(e.g. add '<boost_home>/include')."
); );
} }
@@ -362,15 +296,12 @@ QtProjectWizzardContentPathsHeaderSearchGlobal::QtProjectWizzardContentPathsHead
) )
: QtProjectWizzardContentPaths(settings, window) : QtProjectWizzardContentPaths(settings, window)
{ {
setInfo( setTitleString("Global Include Paths");
"Global Include Paths", setHelpString(
"These include paths will be used in all your projects. Use it to add system header paths " "The Global Include Paths will be used in all your projects - in addition to the project specific Include Paths. "
"(See <a href=\"https://coati.io/documentation/#FindingSystemHeaderLocations\">Finding System Header Locations</a> " "These paths are usually passed to the compiler with the '-isystem' flag.\n\n"
"or use the auto detection below).", "Use them to add system header paths (See <a href=\"https://coati.io/documentation/#FindingSystemHeaderLocations\">"
"Include Paths define where additional files, that your project depends on, are found. Usually they are " "Finding System Header Locations</a> or use the auto detection below)."
"header files of frameworks or libraries that your project uses. These files won't be indexed, but Coati needs "
"them for correct indexing.\n\n"
"Include Paths defined here will be used for all projects."
); );
m_pathDetector = std::make_shared<CombinedPathDetector>(); m_pathDetector = std::make_shared<CombinedPathDetector>();
@@ -399,15 +330,14 @@ void QtProjectWizzardContentPathsHeaderSearchGlobal::save()
QtProjectWizzardContentPathsFrameworkSearch::QtProjectWizzardContentPathsFrameworkSearch( QtProjectWizzardContentPathsFrameworkSearch::QtProjectWizzardContentPathsFrameworkSearch(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, bool isCDB
) )
: QtProjectWizzardContentPaths(settings, window) : QtProjectWizzardContentPaths(settings, window)
{ {
setInfo( setTitleString(isCDB ? "Additional Framework Search Paths" : "Framework Search Paths");
"Framework Search Paths", setHelpString(
"Add search paths to Mac OS framework containers (.framework) that the project depends on.",
"Framework Search Paths define where MacOS framework containers (.framework), that your project depends on, are " "Framework Search Paths define where MacOS framework containers (.framework), that your project depends on, are "
"found." "found. These paths are usually passed to the compiler with the '-iframework' flag."
); );
} }
@@ -439,14 +369,12 @@ QtProjectWizzardContentPathsFrameworkSearchGlobal::QtProjectWizzardContentPathsF
) )
: QtProjectWizzardContentPaths(settings, window) : QtProjectWizzardContentPaths(settings, window)
{ {
setInfo( setTitleString("Global Framework Search Paths");
"Global Framework Search Paths", setHelpString(
"These framework search paths will be used in all your projects. Use it to add system frameworks " "The Global Framework Search Paths will be used in all your projects - in addition to the project specific "
"Framework Search Paths.\n\nThey define where MacOS framework containers (.framework) are found "
"(See <a href=\"https://coati.io/documentation/#FindingSystemHeaderLocations\">" "(See <a href=\"https://coati.io/documentation/#FindingSystemHeaderLocations\">"
"Finding System Header Locations</a> or use the auto detection below).", "Finding System Header Locations</a> or use the auto detection below)."
"Framework Search Paths define where MacOS framework containers (.framework), that your project depends on, are "
"found.\n\n"
"Framework Search Paths defined here will be used for all projects."
); );
m_pathDetector = std::make_shared<CombinedPathDetector>(); m_pathDetector = std::make_shared<CombinedPathDetector>();
@@ -471,9 +399,8 @@ QtProjectWizzardContentPathsClassJava::QtProjectWizzardContentPathsClassJava(
) )
: QtProjectWizzardContentPaths(settings, window) : QtProjectWizzardContentPaths(settings, window)
{ {
setInfo( setTitleString("Class Path");
"Class Path", setHelpString(
"Paths to .jar files and root directories of .class files your project depends on.",
"Enter the paths to .jar files and root directories of .class files your project depends on." "Enter the paths to .jar files and root directories of .class files your project depends on."
); );
} }
@@ -21,17 +21,12 @@ public:
QtProjectWizzardContentPaths(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window); QtProjectWizzardContentPaths(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
// QtSettingsWindow implementation // QtSettingsWindow implementation
virtual void populateWindow(QGridLayout* layout, int& row) override; virtual void populate(QGridLayout* layout, int& row) override;
virtual void populateForm(QGridLayout* layout, int& row) override;
virtual QSize preferredWindowSize() const override;
virtual bool check() override; virtual bool check() override;
protected: protected:
void setInfo(const QString& title, const QString& description, const QString& help);
void setTitleString(const QString& title); void setTitleString(const QString& title);
void setDescriptionString(const QString& description);
void setHelpString(const QString& help); void setHelpString(const QString& help);
void addDetection(QGridLayout* layout, int row); void addDetection(QGridLayout* layout, int row);
@@ -46,7 +41,6 @@ private slots:
private: private:
QString m_titleString; QString m_titleString;
QString m_descriptionString;
QString m_helpString; QString m_helpString;
QComboBox* m_detectorBox; QComboBox* m_detectorBox;
@@ -60,8 +54,6 @@ public:
QtProjectWizzardContentPathsSource(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window); QtProjectWizzardContentPathsSource(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual QSize preferredWindowSize() const override;
virtual void load() override; virtual void load() override;
virtual void save() override; virtual void save() override;
@@ -100,7 +92,8 @@ class QtProjectWizzardContentPathsHeaderSearch
: public QtProjectWizzardContentPaths : public QtProjectWizzardContentPaths
{ {
public: public:
QtProjectWizzardContentPathsHeaderSearch(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window); QtProjectWizzardContentPathsHeaderSearch(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, bool isCDB = false);
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void load() override; virtual void load() override;
@@ -125,7 +118,8 @@ class QtProjectWizzardContentPathsFrameworkSearch
: public QtProjectWizzardContentPaths : public QtProjectWizzardContentPaths
{ {
public: public:
QtProjectWizzardContentPathsFrameworkSearch(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window); QtProjectWizzardContentPathsFrameworkSearch(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, bool isCDB = false);
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void load() override; virtual void load() override;
@@ -29,12 +29,7 @@ QtProjectWizzardContentPreferences::~QtProjectWizzardContentPreferences()
} }
} }
void QtProjectWizzardContentPreferences::populateWindow(QGridLayout* layout, int& row) void QtProjectWizzardContentPreferences::populate(QGridLayout* layout, int& row)
{
populateForm(layout, row);
}
void QtProjectWizzardContentPreferences::populateForm(QGridLayout* layout, int& row)
{ {
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get(); ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
@@ -19,8 +19,7 @@ public:
~QtProjectWizzardContentPreferences(); ~QtProjectWizzardContentPreferences();
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void populateWindow(QGridLayout* layout, int& row) override; virtual void populate(QGridLayout* layout, int& row) override;
virtual void populateForm(QGridLayout* layout, int& row) override;
virtual void load() override; virtual void load() override;
virtual void save() override; virtual void save() override;
@@ -20,7 +20,7 @@ QtProjectWizzardContentSelect::QtProjectWizzardContentSelect(
{ {
} }
void QtProjectWizzardContentSelect::populateWindow(QGridLayout* layout, int& row) void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
{ {
QPushButton* d = new QPushButton(languageTypeToString(LANGUAGE_CPP).c_str(), this); QPushButton* d = new QPushButton(languageTypeToString(LANGUAGE_CPP).c_str(), this);
QPushButton* e = new QPushButton(languageTypeToString(LANGUAGE_C).c_str(), this); QPushButton* e = new QPushButton(languageTypeToString(LANGUAGE_C).c_str(), this);
@@ -81,14 +81,14 @@ void QtProjectWizzardContentSelect::populateWindow(QGridLayout* layout, int& row
QToolButton* a = createProjectButton( QToolButton* a = createProjectButton(
"empty project", (ResourcePaths::getGuiPath() + "icon/project_256_256.png").c_str()); "Empty Project", (ResourcePaths::getGuiPath() + "icon/project_256_256.png").c_str());
QToolButton* c = createProjectButton( QToolButton* c = createProjectButton(
"from Compilation\nDatabase", (ResourcePaths::getGuiPath() + "icon/project_cdb_256_256.png").c_str()); "from Compilation\nDatabase", (ResourcePaths::getGuiPath() + "icon/project_cdb_256_256.png").c_str());
m_solutionDescription.push_back("Create a new Coati project by defining what files will be indexed."); m_solutionDescription.push_back("Create a new Coati project by defining what files will be indexed.");
m_solutionDescription.push_back("Create a project from an existing Compilation Database. Compilation Databases can be created from " m_solutionDescription.push_back(
"Make and CMake projects. Have a look at the " "Create a project from an existing Compilation Database (compile_commands.json). They can be created from Make and "
"<a href=\"https://coati.io/documentation/#CreateAProjectFromCompilationDatabase\">" "CMake projects. Have a look at the <a href=\"https://coati.io/documentation/#CreateAProjectFromCompilationDatabase\">"
"documentation</a> to find out more."); "documentation</a> to find out more.");
m_buttons = new QButtonGroup(this); m_buttons = new QButtonGroup(this);
@@ -187,8 +187,3 @@ bool QtProjectWizzardContentSelect::check()
return true; return true;
} }
QSize QtProjectWizzardContentSelect::preferredWindowSize() const
{
return QSize(570, 380);
}
@@ -20,16 +20,16 @@ public:
}; };
QtProjectWizzardContentSelect( QtProjectWizzardContentSelect(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, std::weak_ptr<SolutionParserManager> solutionParserManager); std::shared_ptr<ProjectSettings> settings,
QtProjectWizzardWindow* window,
std::weak_ptr<SolutionParserManager> solutionParserManager);
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void populateWindow(QGridLayout* layout, int& row) override; virtual void populate(QGridLayout* layout, int& row) override;
virtual void save() override; virtual void save() override;
virtual bool check() override; virtual bool check() override;
virtual QSize preferredWindowSize() const override;
signals: signals:
void selected(LanguageType, QtProjectWizzardContentSelect::ProjectType); void selected(LanguageType, QtProjectWizzardContentSelect::ProjectType);
@@ -11,37 +11,19 @@ QtProjectWizzardContentSimple::QtProjectWizzardContentSimple(std::shared_ptr<Pro
{ {
} }
void QtProjectWizzardContentSimple::populateWindow(QGridLayout* layout, int& row) void QtProjectWizzardContentSimple::populate(QGridLayout* layout, int& row)
{ {
QLabel* title = new QLabel("Lazy Include Search"); m_title = createFormLabel("Lazy Include Search");
title->setWordWrap(true); layout->addWidget(m_title, row, QtProjectWizzardWindow::FRONT_COL);
title->setObjectName("section");
layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
layout->setRowStretch(row, 0);
QLabel* text = new QLabel("Search for included files in all subdirectories of the project paths. "
"Warning: This slows down indexing speed.");
text->setWordWrap(true);
layout->addWidget(text, row + 1, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
layout->setRowStretch(row + 1, 1);
m_checkBox = new QCheckBox("Search included files within the project paths"); m_checkBox = new QCheckBox("Search included files within the project paths");
layout->addWidget(m_checkBox, row, QtProjectWizzardWindow::BACK_COL); layout->addWidget(m_checkBox, row, QtProjectWizzardWindow::BACK_COL);
row += 2; addHelpButton(
} "If enabled Coati also uses the project paths and their subdirectories when resolving #include directives.\n\n"
"Use this option when you know that the project is self contained but don't know which paths to "
void QtProjectWizzardContentSimple::populateForm(QGridLayout* layout, int& row) "specify as include paths.\n\n"
{ "<b>Warning</b>: This slows down indexing speed.", layout, row);
QLabel* label = createFormLabel("Lazy Include Search");
layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL);
m_checkBox = new QCheckBox("Search included files within the project paths");
layout->addWidget(m_checkBox, row, QtProjectWizzardWindow::BACK_COL);
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 index.\n"
"Warning: This option slows down indexing speed.", layout, row);
row++; row++;
} }
@@ -15,14 +15,14 @@ public:
QtProjectWizzardContentSimple(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window); QtProjectWizzardContentSimple(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void populateWindow(QGridLayout* layout, int& row) override; virtual void populate(QGridLayout* layout, int& row) override;
virtual void populateForm(QGridLayout* layout, int& row) override;
virtual void load() override; virtual void load() override;
virtual void save() override; virtual void save() override;
private: private:
QCheckBox* m_checkBox; QCheckBox* m_checkBox;
QLabel* m_title;
}; };
#endif // QT_PROJECT_WIZZARD_CONTENT_SIMPLE_H #endif // QT_PROJECT_WIZZARD_CONTENT_SIMPLE_H
@@ -20,6 +20,8 @@ void QtProjectWizzardContentSummary::addContent(QtProjectWizzardContent* content
element.advanced = advanced; element.advanced = advanced;
element.gapBefore = gapBefore; element.gapBefore = gapBefore;
m_elements.push_back(element); m_elements.push_back(element);
content->setIsInForm(m_isForm);
} }
void QtProjectWizzardContentSummary::setIsForm(bool isForm) void QtProjectWizzardContentSummary::setIsForm(bool isForm)
@@ -27,7 +29,7 @@ void QtProjectWizzardContentSummary::setIsForm(bool isForm)
m_isForm = isForm; m_isForm = isForm;
} }
void QtProjectWizzardContentSummary::populateWindow(QGridLayout* layout, int& row) void QtProjectWizzardContentSummary::populate(QGridLayout* layout, int& row)
{ {
if (m_isForm) if (m_isForm)
{ {
@@ -35,7 +37,7 @@ void QtProjectWizzardContentSummary::populateWindow(QGridLayout* layout, int& ro
return; return;
} }
layout->setRowMinimumHeight(row++, 10); layout->setRowMinimumHeight(row++, 20);
for (const Element& element : m_elements) for (const Element& element : m_elements)
{ {
@@ -49,10 +51,10 @@ void QtProjectWizzardContentSummary::populateWindow(QGridLayout* layout, int& ro
layout->setRowMinimumHeight(row++, 20); layout->setRowMinimumHeight(row++, 20);
} }
element.content->populateWindow(layout, row); element.content->populate(layout, row);
} }
layout->setRowMinimumHeight(row, 10); layout->setRowMinimumHeight(row, 20);
layout->setRowStretch(row, 1); layout->setRowStretch(row, 1);
} }
@@ -78,7 +80,7 @@ void QtProjectWizzardContentSummary::populateForm(QGridLayout* layout, int& row)
layout->setRowMinimumHeight(row++, 15); layout->setRowMinimumHeight(row++, 15);
} }
element.content->populateForm(layout, row); element.content->populate(layout, row);
} }
if (i > 0 || !hasAdvanced) if (i > 0 || !hasAdvanced)
@@ -26,8 +26,8 @@ public:
protected: protected:
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void populateWindow(QGridLayout* layout, int& row) override; virtual void populate(QGridLayout* layout, int& row) override;
virtual void populateForm(QGridLayout* layout, int& row) override; void populateForm(QGridLayout* layout, int& row);
virtual void load() override; virtual void load() override;
virtual void save() override; virtual void save() override;
@@ -17,11 +17,11 @@ QtProjectWizzardWindow::QtProjectWizzardWindow(QWidget *parent)
QSize QtProjectWizzardWindow::sizeHint() const QSize QtProjectWizzardWindow::sizeHint() const
{ {
if (content()) if (m_preferredSize.width())
{ {
return content()->preferredWindowSize(); return m_preferredSize;
} }
return QSize(); return QSize(750, 620);
} }
QtProjectWizzardContent* QtProjectWizzardWindow::content() const QtProjectWizzardContent* QtProjectWizzardWindow::content() const
@@ -35,13 +35,24 @@ void QtProjectWizzardWindow::setContent(QtProjectWizzardContent* content)
setScrollAble(content->isScrollAble()); setScrollAble(content->isScrollAble());
} }
void QtProjectWizzardWindow::setPreferredSize(QSize size)
{
m_preferredSize = size;
}
void QtProjectWizzardWindow::populateWindow(QWidget* widget) void QtProjectWizzardWindow::populateWindow(QWidget* widget)
{ {
QGridLayout* layout = new QGridLayout(); QGridLayout* layout = new QGridLayout();
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1);
layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 3);
layout->setColumnStretch(HELP_COL, 0);
layout->setColumnStretch(LINE_COL, 0);
int row = 0; int row = 0;
m_content->populateWindow(layout, row); m_content->populate(layout, row);
QFrame* separator = new QFrame(); QFrame* separator = new QFrame();
separator->setFrameShape(QFrame::VLine); separator->setFrameShape(QFrame::VLine);
@@ -52,9 +63,6 @@ void QtProjectWizzardWindow::populateWindow(QWidget* widget)
layout->addWidget(separator, 0, LINE_COL, -1, 1); layout->addWidget(separator, 0, LINE_COL, -1, 1);
layout->setColumnStretch(HELP_COL, 0);
layout->setColumnStretch(LINE_COL, 0);
if (isScrollAble()) if (isScrollAble())
{ {
layout->setColumnMinimumWidth(BACK_COL + 1, 10); layout->setColumnMinimumWidth(BACK_COL + 1, 10);
@@ -18,6 +18,8 @@ public:
QtProjectWizzardContent* content() const; QtProjectWizzardContent* content() const;
void setContent(QtProjectWizzardContent* content); void setContent(QtProjectWizzardContent* content);
void setPreferredSize(QSize size);
static const int FRONT_COL = 0; static const int FRONT_COL = 0;
static const int HELP_COL = 1; static const int HELP_COL = 1;
static const int LINE_COL = 2; static const int LINE_COL = 2;
@@ -33,6 +35,7 @@ protected:
private: private:
QtProjectWizzardContent* m_content; QtProjectWizzardContent* m_content;
QSize m_preferredSize;
}; };
#endif // QT_PROJECT_WIZZARD_WINDOW_H #endif // QT_PROJECT_WIZZARD_WINDOW_H