ui: Added ui for compiler flags to project setup summary
bug id = 37
This commit is contained in:
@@ -51,7 +51,8 @@ bool ProjectSettings::operator==(const ProjectSettings& other) const
|
||||
getUseSourcePathsForHeaderSearch() == other.getUseSourcePathsForHeaderSearch() &&
|
||||
utility::isPermutation<FilePath>(getSourcePaths(), other.getSourcePaths()) &&
|
||||
utility::isPermutation<FilePath>(getHeaderSearchPaths(), other.getHeaderSearchPaths()) &&
|
||||
utility::isPermutation<FilePath>(getFrameworkSearchPaths(), other.getFrameworkSearchPaths());
|
||||
utility::isPermutation<FilePath>(getFrameworkSearchPaths(), other.getFrameworkSearchPaths()) &&
|
||||
utility::isPermutation<std::string>(getCompilerFlags(), other.getCompilerFlags());
|
||||
}
|
||||
|
||||
void ProjectSettings::save(const FilePath& filePath)
|
||||
@@ -122,6 +123,11 @@ std::vector<std::string> ProjectSettings::getCompilerFlags() const
|
||||
return getValues("source/compiler_flags/compiler_flag", defaultValues);
|
||||
}
|
||||
|
||||
bool ProjectSettings::setCompilerFlags(const std::vector<std::string>& compilerFlags)
|
||||
{
|
||||
return setValues("source/compiler_flags/compiler_flag", compilerFlags);
|
||||
}
|
||||
|
||||
std::vector<std::string> ProjectSettings::getHeaderExtensions() const
|
||||
{
|
||||
return getValues("source/extensions/header_extensions", getDefaultHeaderExtensions());
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
bool setFrameworkSearchPaths(const std::vector<FilePath>& frameworkSearchPaths);
|
||||
|
||||
std::vector<std::string> getCompilerFlags() const;
|
||||
bool setCompilerFlags(const std::vector<std::string>& compilerFlags);
|
||||
|
||||
std::vector<std::string> getHeaderExtensions() const;
|
||||
std::vector<std::string> getSourceExtensions() const;
|
||||
|
||||
@@ -112,6 +112,8 @@ add_files(
|
||||
qt/window/project_wizzard/QtProjectWizzardContentBuildFile.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
|
||||
|
||||
@@ -33,6 +33,11 @@ QtListItemWidget::QtListItemWidget(QtDirectoryListBox* list, QListWidgetItem* it
|
||||
layout->addWidget(m_data);
|
||||
layout->addWidget(m_button);
|
||||
|
||||
if (list->isForStrings())
|
||||
{
|
||||
m_button->hide();
|
||||
}
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
connect(m_button, SIGNAL(clicked()), this, SLOT(handleButtonPress()));
|
||||
@@ -96,8 +101,9 @@ void QtListItemWidget::handleFocus()
|
||||
}
|
||||
|
||||
|
||||
QtDirectoryListBox::QtDirectoryListBox(QWidget *parent)
|
||||
:QFrame(parent)
|
||||
QtDirectoryListBox::QtDirectoryListBox(QWidget *parent, bool forStrings)
|
||||
: QFrame(parent)
|
||||
, m_forStrings(forStrings)
|
||||
{
|
||||
QBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setSpacing(0);
|
||||
@@ -132,12 +138,19 @@ QtDirectoryListBox::QtDirectoryListBox(QWidget *parent)
|
||||
m_removeButton->setObjectName("minusButton");
|
||||
innerLayout->addWidget(m_removeButton);
|
||||
|
||||
innerLayout->addStretch();
|
||||
|
||||
QLabel* dropInfoText = new QLabel("Drop Files & Folders");
|
||||
dropInfoText->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
dropInfoText->setObjectName("dropInfo");
|
||||
dropInfoText->setAlignment(Qt::AlignRight);
|
||||
innerLayout->addWidget(dropInfoText);
|
||||
|
||||
if (isForStrings())
|
||||
{
|
||||
dropInfoText->hide();
|
||||
}
|
||||
|
||||
layout->addStretch();
|
||||
|
||||
buttonContainer->setLayout(innerLayout);
|
||||
@@ -198,7 +211,28 @@ void QtDirectoryListBox::dropEvent(QDropEvent *event)
|
||||
|
||||
std::vector<FilePath> QtDirectoryListBox::getList()
|
||||
{
|
||||
std::vector<std::string> strList = getStringList();
|
||||
std::vector<FilePath> list;
|
||||
for (const std::string& str : strList)
|
||||
{
|
||||
list.push_back(str);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
void QtDirectoryListBox::setList(const std::vector<FilePath>& list)
|
||||
{
|
||||
std::vector<std::string> strList;
|
||||
for (const FilePath& path : list)
|
||||
{
|
||||
strList.push_back(path.str());
|
||||
}
|
||||
setStringList(strList);
|
||||
}
|
||||
|
||||
std::vector<std::string> QtDirectoryListBox::getStringList()
|
||||
{
|
||||
std::vector<std::string> list;
|
||||
for (int i = 0; i < m_list->count(); ++i)
|
||||
{
|
||||
QtListItemWidget* widget = dynamic_cast<QtListItemWidget*>(m_list->itemWidget(m_list->item(i)));
|
||||
@@ -207,14 +241,14 @@ std::vector<FilePath> QtDirectoryListBox::getList()
|
||||
return list;
|
||||
}
|
||||
|
||||
void QtDirectoryListBox::setList(const std::vector<FilePath>& list)
|
||||
void QtDirectoryListBox::setStringList(const std::vector<std::string>& list)
|
||||
{
|
||||
m_list->clear();
|
||||
|
||||
for (const FilePath& path : list)
|
||||
for (const std::string& str : list)
|
||||
{
|
||||
QtListItemWidget* widget = addListBoxItem();
|
||||
widget->setText(QString::fromStdString(path.str()));
|
||||
widget->setText(QString::fromStdString(str));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,6 +262,11 @@ void QtDirectoryListBox::selectItem(QListWidgetItem* item)
|
||||
item->setSelected(true);
|
||||
}
|
||||
|
||||
bool QtDirectoryListBox::isForStrings() const
|
||||
{
|
||||
return m_forStrings;
|
||||
}
|
||||
|
||||
void QtDirectoryListBox::resize()
|
||||
{
|
||||
int height = m_list->height() - m_list->viewport()->height();
|
||||
|
||||
@@ -46,7 +46,7 @@ class QtDirectoryListBox
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtDirectoryListBox(QWidget *parent);
|
||||
QtDirectoryListBox(QWidget *parent, bool forStrings = false);
|
||||
|
||||
virtual QSize sizeHint() const override;
|
||||
|
||||
@@ -55,8 +55,13 @@ public:
|
||||
std::vector<FilePath> getList();
|
||||
void setList(const std::vector<FilePath>& list);
|
||||
|
||||
std::vector<std::string> getStringList();
|
||||
void setStringList(const std::vector<std::string>& list);
|
||||
|
||||
void selectItem(QListWidgetItem* item);
|
||||
|
||||
bool isForStrings() const;
|
||||
|
||||
protected:
|
||||
bool event(QEvent* event) override;
|
||||
|
||||
@@ -70,6 +75,8 @@ private:
|
||||
QPushButton* m_removeButton;
|
||||
QListWidget* m_list;
|
||||
|
||||
bool m_forStrings;
|
||||
|
||||
private slots:
|
||||
QtListItemWidget* addListBoxItem();
|
||||
void removeListBoxItem();
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentFlags.h"
|
||||
|
||||
#include <QFormLayout>
|
||||
|
||||
#include "qt/element/QtDirectoryListBox.h"
|
||||
|
||||
QtProjectWizzardContentFlags::QtProjectWizzardContentFlags(ProjectSettings* settings, QtProjectWizzardWindow* window)
|
||||
: QtProjectWizzardContent(settings, window)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentFlags::populateForm(QGridLayout* layout, int& row)
|
||||
{
|
||||
QLabel* label = createFormLabel("Compiler Flags");
|
||||
label->setObjectName("label");
|
||||
layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
|
||||
addHelpButton("Define compiler flags used during analysis including the dash e.g. -v", layout, row);
|
||||
|
||||
m_list = new QtDirectoryListBox(this, true);
|
||||
layout->addWidget(m_list, row, QtProjectWizzardWindow::BACK_COL);
|
||||
row++;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentFlags::load()
|
||||
{
|
||||
m_list->setStringList(m_settings->getCompilerFlags());
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentFlags::save()
|
||||
{
|
||||
m_settings->setCompilerFlags(m_list->getStringList());
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_FLAGS_H
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_FLAGS_H
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QtDirectoryListBox;
|
||||
|
||||
class QtProjectWizzardContentFlags
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentFlags(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populateForm(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
private:
|
||||
QtDirectoryListBox* m_list;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_FLAGS_H
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
class QtDirectoryListBox;
|
||||
|
||||
|
||||
class QtProjectWizzardContentPaths
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
|
||||
@@ -21,6 +21,8 @@ QtProjectWizzardContentSummary::QtProjectWizzardContentSummary(ProjectSettings*
|
||||
{
|
||||
m_frameworkSearch = new QtProjectWizzardContentPathsFrameworkSearch(settings, window);
|
||||
}
|
||||
|
||||
m_compilerFlags = new QtProjectWizzardContentFlags(settings, window);
|
||||
}
|
||||
|
||||
QtProjectWizzardContentBuildFile* QtProjectWizzardContentSummary::contentBuildFile()
|
||||
@@ -66,6 +68,25 @@ void QtProjectWizzardContentSummary::populateWindow(QGridLayout* layout)
|
||||
m_frameworkSearch->populateForm(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);
|
||||
}
|
||||
|
||||
@@ -87,6 +108,8 @@ void QtProjectWizzardContentSummary::load()
|
||||
{
|
||||
m_frameworkSearch->load();
|
||||
}
|
||||
|
||||
m_compilerFlags->load();
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSummary::save()
|
||||
@@ -101,6 +124,8 @@ void QtProjectWizzardContentSummary::save()
|
||||
{
|
||||
m_frameworkSearch->save();
|
||||
}
|
||||
|
||||
m_compilerFlags->save();
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentSummary::check()
|
||||
@@ -111,7 +136,8 @@ bool QtProjectWizzardContentSummary::check()
|
||||
m_source->check() &&
|
||||
m_simple->check() &&
|
||||
m_headerSearch->check() &&
|
||||
(!m_frameworkSearch || m_frameworkSearch->check());
|
||||
(!m_frameworkSearch || m_frameworkSearch->check()) &&
|
||||
m_compilerFlags->check();
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentSummary::isScrollAble() const
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#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"
|
||||
|
||||
@@ -34,6 +35,7 @@ private:
|
||||
QtProjectWizzardContentSimple* m_simple;
|
||||
QtProjectWizzardContentPathsHeaderSearch* m_headerSearch;
|
||||
QtProjectWizzardContentPathsFrameworkSearch* m_frameworkSearch;
|
||||
QtProjectWizzardContentFlags* m_compilerFlags;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_SUMMARY_H
|
||||
|
||||
Reference in New Issue
Block a user