ui: Rewrote project setup to wizzard
* QtProjectWizzard handles window managment logic of project setup * QtProjectWizzardWindow is used in every step and displays QtProjectWizzardContent * QtProjectWizzardContent is the base class for all differnt content types * Removed Singleton from ProjectSettings * ProjectSettings are created by wizzard and QtProjectWizzardContent can access and load * added project type selection at start of wizzard * added summary at end of wizzard * show global search paths in setup and summary * fixed layout problems after font switch * fixed scrolling and resizing of QtDirectoryListBox * separated QtLocationPicker to own class
This commit is contained in:
@@ -0,0 +1,153 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzard.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QSysInfo>
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentData.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSummary.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
|
||||
#include "utility/messaging/type/MessageLoadProject.h"
|
||||
|
||||
QtProjectWizzard::QtProjectWizzard(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, m_windowStack(this)
|
||||
{
|
||||
connect(&m_windowStack, SIGNAL(push()), this, SLOT(windowStackChanged()));
|
||||
connect(&m_windowStack, SIGNAL(pop()), this, SLOT(windowStackChanged()));
|
||||
}
|
||||
|
||||
void QtProjectWizzard::newProject()
|
||||
{
|
||||
m_settings = ProjectSettings();
|
||||
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentSelect>();
|
||||
|
||||
connect(dynamic_cast<QtProjectWizzardContentSelect*>(window->content()),
|
||||
SIGNAL(selected(QtProjectWizzardContentSelect::ProjectType)),
|
||||
this, SLOT(selectedProjectType(QtProjectWizzardContentSelect::ProjectType)));
|
||||
|
||||
window->disableNext();
|
||||
window->disablePrevious();
|
||||
}
|
||||
|
||||
void QtProjectWizzard::editProject(const ProjectSettings& settings)
|
||||
{
|
||||
m_settings = settings;
|
||||
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentSummary>();
|
||||
window->updateTitle("EDIT PROJECT");
|
||||
window->updateDoneButton("Save");
|
||||
|
||||
window->hidePrevious();
|
||||
connect(window, SIGNAL(next()), this, SLOT(createProject()));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
QtProjectWizzardWindow* QtProjectWizzard::createWindowWithContent()
|
||||
{
|
||||
QtProjectWizzardWindow* window = new QtProjectWizzardWindow(parentWidget());
|
||||
|
||||
window->setContent(new T(&m_settings, window));
|
||||
|
||||
window->setup();
|
||||
|
||||
connect(window, SIGNAL(previous()), &m_windowStack, SLOT(popWindow()));
|
||||
connect(window, SIGNAL(canceled()), this, SLOT(cancelWizzard()));
|
||||
|
||||
m_windowStack.pushWindow(window);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
void QtProjectWizzard::cancelWizzard()
|
||||
{
|
||||
m_windowStack.clearWindows();
|
||||
emit canceled();
|
||||
}
|
||||
|
||||
void QtProjectWizzard::windowStackChanged()
|
||||
{
|
||||
QWidget* window = m_windowStack.getTopWindow();
|
||||
|
||||
if (window)
|
||||
{
|
||||
dynamic_cast<QtProjectWizzardWindow*>(window)->content()->load();
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzard::selectedProjectType(QtProjectWizzardContentSelect::ProjectType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case QtProjectWizzardContentSelect::PROJECT_EMPTY:
|
||||
emptyProject();
|
||||
break;
|
||||
|
||||
case QtProjectWizzardContentSelect::PROJECT_CDB:
|
||||
case QtProjectWizzardContentSelect::PROJECT_VS:
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Project type not implemented yet!");
|
||||
msgBox.exec();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzard::emptyProject()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentData>();
|
||||
// connect(window, SIGNAL(next()), this, SLOT(simpleSetup()));
|
||||
connect(window, SIGNAL(next()), this, SLOT(sourcePaths()));
|
||||
}
|
||||
|
||||
void QtProjectWizzard::simpleSetup()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentSimple>();
|
||||
connect(window, SIGNAL(next()), this, SLOT(sourcePaths()));
|
||||
}
|
||||
|
||||
void QtProjectWizzard::sourcePaths()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentPathsSource>();
|
||||
connect(window, SIGNAL(next()), this, SLOT(headerSearchPaths()));
|
||||
}
|
||||
|
||||
void QtProjectWizzard::headerSearchPaths()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentPathsHeaderSearch>();
|
||||
|
||||
if (QSysInfo::macVersion() != QSysInfo::MV_None)
|
||||
{
|
||||
connect(window, SIGNAL(next()), this, SLOT(frameworkSearchPaths()));
|
||||
}
|
||||
else
|
||||
{
|
||||
connect(window, SIGNAL(next()), this, SLOT(showSummary()));
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzard::frameworkSearchPaths()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentPathsFrameworkSearch>();
|
||||
connect(window, SIGNAL(next()), this, SLOT(showSummary()));
|
||||
}
|
||||
|
||||
void QtProjectWizzard::showSummary()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentSummary>();
|
||||
connect(window, SIGNAL(next()), this, SLOT(createProject()));
|
||||
}
|
||||
|
||||
void QtProjectWizzard::createProject()
|
||||
{
|
||||
std::string path = m_settings.getProjectFileLocation() + "/" + m_settings.getProjectName() + ".coatiproject";
|
||||
|
||||
m_settings.save(path);
|
||||
|
||||
MessageLoadProject(path, true).dispatch();
|
||||
|
||||
m_windowStack.clearWindows();
|
||||
emit finished();
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_H
|
||||
#define QT_PROJECT_WIZZARD_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSelect.h"
|
||||
#include "qt/window/QtWindowStack.h"
|
||||
|
||||
class ProjectSettings;
|
||||
class QtProjectWizzardWindow;
|
||||
|
||||
class QtProjectWizzard
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
void canceled();
|
||||
|
||||
public:
|
||||
QtProjectWizzard(QWidget* parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void newProject();
|
||||
void editProject(const ProjectSettings& settings);
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
QtProjectWizzardWindow* createWindowWithContent();
|
||||
|
||||
QtWindowStack m_windowStack;
|
||||
ProjectSettings m_settings;
|
||||
|
||||
private slots:
|
||||
void cancelWizzard();
|
||||
void windowStackChanged();
|
||||
|
||||
void selectedProjectType(QtProjectWizzardContentSelect::ProjectType type);
|
||||
|
||||
void emptyProject();
|
||||
void simpleSetup();
|
||||
void sourcePaths();
|
||||
void headerSearchPaths();
|
||||
void frameworkSearchPaths();
|
||||
|
||||
void showSummary();
|
||||
|
||||
void createProject();
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_H
|
||||
@@ -0,0 +1,33 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
QtProjectWizzardContent::QtProjectWizzardContent(ProjectSettings* settings, QtProjectWizzardWindow* window)
|
||||
: QWidget(window)
|
||||
, m_settings(settings)
|
||||
, m_window(window)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContent::populateWindow(QWidget* widget)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContent::populateForm(QFormLayout* layout)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContent::windowReady()
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContent::load()
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContent::save()
|
||||
{
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContent::check()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_H
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
|
||||
#include "settings/ProjectSettings.h"
|
||||
|
||||
class QFormLayout;
|
||||
|
||||
class QtProjectWizzardContent
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContent(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
virtual void populateWindow(QWidget* widget);
|
||||
virtual void populateForm(QFormLayout* layout);
|
||||
virtual void windowReady();
|
||||
|
||||
virtual void load();
|
||||
virtual void save();
|
||||
virtual bool check();
|
||||
|
||||
protected:
|
||||
ProjectSettings* m_settings;
|
||||
QtProjectWizzardWindow* m_window;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_H
|
||||
@@ -0,0 +1,153 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentData.h"
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QMessageBox>
|
||||
|
||||
QtProjectWizzardContentData::QtProjectWizzardContentData(ProjectSettings* settings, QtProjectWizzardWindow* window)
|
||||
: QtProjectWizzardContent(settings, window)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentData::populateWindow(QWidget* widget)
|
||||
{
|
||||
QFormLayout* layout = new QFormLayout();
|
||||
layout->setContentsMargins(10, 10, 10, 10);
|
||||
layout->setHorizontalSpacing(20);
|
||||
|
||||
populateForm(layout);
|
||||
|
||||
widget->setLayout(layout);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentData::populateForm(QFormLayout* layout)
|
||||
{
|
||||
int minimumWidthForSecondCol = 360;
|
||||
|
||||
QLabel* nameLabel = new QLabel("Name");
|
||||
nameLabel->setObjectName("label");
|
||||
m_projectName = new QLineEdit();
|
||||
m_projectName->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||
m_projectName->setMinimumWidth(minimumWidthForSecondCol);
|
||||
m_projectName->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
||||
layout->addRow(nameLabel, m_projectName);
|
||||
|
||||
QLabel* locationLabel = new QLabel("Location");
|
||||
locationLabel->setObjectName("label");
|
||||
m_projectFileLocation = new QtLocationPicker(this);
|
||||
m_projectFileLocation->setMinimumWidth(minimumWidthForSecondCol);
|
||||
layout->addRow(locationLabel, m_projectFileLocation);
|
||||
|
||||
QLabel* languageLabel = new QLabel("Language");
|
||||
languageLabel->setObjectName("label");
|
||||
m_language = new QComboBox();
|
||||
m_language->insertItem(0, "C++");
|
||||
m_language->insertItem(1, "C");
|
||||
connect(m_language, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int)));
|
||||
layout->addRow(languageLabel, m_language);
|
||||
|
||||
m_cppStandardLabel = new QLabel("Standard");
|
||||
m_cppStandardLabel->setObjectName("label");
|
||||
|
||||
m_cppStandard = new QComboBox();
|
||||
m_cppStandard->insertItem(0, "1z");
|
||||
m_cppStandard->insertItem(1, "14");
|
||||
m_cppStandard->insertItem(2, "1y");
|
||||
m_cppStandard->insertItem(3, "11");
|
||||
m_cppStandard->insertItem(4, "0x");
|
||||
m_cppStandard->insertItem(5, "03");
|
||||
m_cppStandard->insertItem(6, "98");
|
||||
layout->addRow(m_cppStandardLabel, m_cppStandard);
|
||||
|
||||
|
||||
m_cStandardLabel = new QLabel("Standard");
|
||||
m_cStandardLabel->setObjectName("label");
|
||||
|
||||
m_cStandard = new QComboBox();
|
||||
m_cStandard->insertItem(0, "1x");
|
||||
m_cStandard->insertItem(1, "11");
|
||||
m_cStandard->insertItem(2, "9x");
|
||||
m_cStandard->insertItem(3, "99");
|
||||
m_cStandard->insertItem(4, "90");
|
||||
m_cStandard->insertItem(5, "89");
|
||||
layout->addRow(m_cStandardLabel, m_cStandard);
|
||||
m_cStandardLabel->hide();
|
||||
m_cStandard->hide();
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentData::load()
|
||||
{
|
||||
m_projectName->setText(QString::fromStdString(m_settings->getProjectName()));
|
||||
m_projectFileLocation->setText(QString::fromStdString(m_settings->getProjectFileLocation()));
|
||||
|
||||
if (m_settings->getLanguage().length() > 0)
|
||||
{
|
||||
m_language->setCurrentText(QString::fromStdString(m_settings->getLanguage()));
|
||||
}
|
||||
|
||||
if (m_settings->getStandard().length() > 0)
|
||||
{
|
||||
if (m_language->currentIndex() == 0) // c++
|
||||
{
|
||||
m_cppStandard->setCurrentText(QString::fromStdString(m_settings->getStandard()));
|
||||
}
|
||||
else if (m_language->currentIndex() == 1) // c
|
||||
{
|
||||
m_cStandard->setCurrentText(QString::fromStdString(m_settings->getStandard()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentData::save()
|
||||
{
|
||||
m_settings->setProjectName(m_projectName->text().toStdString());
|
||||
m_settings->setProjectFileLocation(m_projectFileLocation->getText().toStdString());
|
||||
m_settings->setLanguage(m_language->currentText().toStdString());
|
||||
|
||||
if (m_cppStandard->isVisible())
|
||||
{
|
||||
m_settings->setStandard(m_cppStandard->currentText().toStdString());
|
||||
}
|
||||
else if (m_cStandard->isVisible())
|
||||
{
|
||||
m_settings->setStandard(m_cStandard->currentText().toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentData::check()
|
||||
{
|
||||
if (m_projectName->text().isEmpty())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Please enter a project name.");
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_projectFileLocation->getText().isEmpty())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Please define the location of the project file.");
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentData::handleSelectionChanged(int index)
|
||||
{
|
||||
if (index != 0)
|
||||
{
|
||||
m_cStandardLabel->show();
|
||||
m_cStandard->show();
|
||||
m_cppStandardLabel->hide();
|
||||
m_cppStandard->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cppStandardLabel->show();
|
||||
m_cppStandard->show();
|
||||
m_cStandardLabel->hide();
|
||||
m_cStandard->hide();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_DATA_H
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_DATA_H
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
#include "qt/element/QtLocationPicker.h"
|
||||
|
||||
class QtProjectWizzardContentData
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentData(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populateWindow(QWidget* widget) override;
|
||||
virtual void populateForm(QFormLayout* layout) override;
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
virtual bool check() override;
|
||||
|
||||
private:
|
||||
QLineEdit* m_projectName;
|
||||
QtLocationPicker* m_projectFileLocation;
|
||||
|
||||
QComboBox* m_language;
|
||||
QComboBox* m_cppStandard;
|
||||
QComboBox* m_cStandard;
|
||||
|
||||
QLabel* m_cppStandardLabel;
|
||||
QLabel* m_cStandardLabel;
|
||||
|
||||
private slots:
|
||||
void handleSelectionChanged(int index);
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_DATA_H
|
||||
@@ -0,0 +1,291 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "qt/element/QtDirectoryListBox.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
|
||||
QtHelpButton::QtHelpButton(const QString& helpText, QWidget* parent)
|
||||
: QPushButton("?", parent)
|
||||
, m_helpText(helpText)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
setObjectName("help");
|
||||
|
||||
connect(this, SIGNAL(clicked()), this, SLOT(handleHelpPress()));
|
||||
}
|
||||
|
||||
void QtHelpButton::handleHelpPress()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Help");
|
||||
msgBox.setInformativeText(m_helpText);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
|
||||
QtProjectWizzardContentPaths::QtProjectWizzardContentPaths(ProjectSettings* settings, QtProjectWizzardWindow* window)
|
||||
: QtProjectWizzardContent(settings, window)
|
||||
, m_subPaths(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPaths::populateWindow(QWidget* widget)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(widget);
|
||||
|
||||
populateLayout(layout);
|
||||
|
||||
if (m_subPaths)
|
||||
{
|
||||
layout->addSpacing(30);
|
||||
|
||||
m_subPaths->populateLayout(layout);
|
||||
}
|
||||
|
||||
layout->addStretch();
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPaths::populateLayout(QVBoxLayout* layout)
|
||||
{
|
||||
QLabel* label = new QLabel(m_titleString);
|
||||
label->setObjectName("label");
|
||||
layout->addWidget(label);
|
||||
|
||||
QLabel* text = new QLabel(m_descriptionString);
|
||||
text->setWordWrap(true);
|
||||
layout->addWidget(text);
|
||||
|
||||
m_list = new QtDirectoryListBox(this);
|
||||
layout->addWidget(m_list);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPaths::populateForm(QFormLayout* layout)
|
||||
{
|
||||
QWidget* widget = new QWidget();
|
||||
|
||||
QVBoxLayout* vlayout = new QVBoxLayout();
|
||||
vlayout->setContentsMargins(0, 5, 0, 5);
|
||||
vlayout->setSpacing(5);
|
||||
|
||||
QLabel* label = new QLabel(m_titleString);
|
||||
label->setAlignment(Qt::AlignRight);
|
||||
label->setObjectName("label");
|
||||
label->setWordWrap(true);
|
||||
vlayout->addWidget(label);
|
||||
|
||||
QtHelpButton* button = new QtHelpButton(m_helpString);
|
||||
|
||||
vlayout->addWidget(button, 0, Qt::AlignRight);
|
||||
vlayout->addStretch();
|
||||
|
||||
widget->setLayout(vlayout);
|
||||
|
||||
int minimumWidthForSecondCol = 360;
|
||||
m_list = new QtDirectoryListBox(this);
|
||||
m_list->setMinimumWidth(minimumWidthForSecondCol);
|
||||
layout->addRow(widget, m_list);
|
||||
|
||||
if (m_subPaths)
|
||||
{
|
||||
m_subPaths->populateForm(layout);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPaths::load()
|
||||
{
|
||||
loadPaths();
|
||||
|
||||
if (m_subPaths)
|
||||
{
|
||||
return m_subPaths->loadPaths();
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPaths::save()
|
||||
{
|
||||
savePaths();
|
||||
|
||||
if (m_subPaths)
|
||||
{
|
||||
return m_subPaths->savePaths();
|
||||
}
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentPaths::check()
|
||||
{
|
||||
if (m_subPaths)
|
||||
{
|
||||
return checkPaths() && m_subPaths->checkPaths();
|
||||
}
|
||||
|
||||
return checkPaths();
|
||||
}
|
||||
|
||||
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;
|
||||
m_descriptionString = description;
|
||||
m_helpString = help;
|
||||
}
|
||||
|
||||
|
||||
QtProjectWizzardContentPathsSource::QtProjectWizzardContentPathsSource(
|
||||
ProjectSettings* settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContentPaths(settings, window)
|
||||
{
|
||||
setInfo(
|
||||
"Analyzed Paths",
|
||||
"Analyzed Paths define the source files and directories that will be analysed by Coati. Usually these are the "
|
||||
"source and header files of your project or a subset of them.",
|
||||
"Analyzed Paths define the source files and directories that will be analysed by Coati. Usually these are the "
|
||||
"source and header files of your project or a subset of them."
|
||||
);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsSource::loadPaths()
|
||||
{
|
||||
m_list->setList(m_settings->getSourcePaths());
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsSource::savePaths()
|
||||
{
|
||||
m_settings->setSourcePaths(m_list->getList());
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentPathsSource::checkPaths()
|
||||
{
|
||||
if (m_list->getList().size() == 0)
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Please set at least one source path for Coati to analyse.");
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QtProjectWizzardContentPathsHeaderSearch::QtProjectWizzardContentPathsHeaderSearch(
|
||||
ProjectSettings* settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContentPaths(settings, window)
|
||||
{
|
||||
setInfo(
|
||||
"Header Search Paths",
|
||||
"Header Search Paths define where additional headers, 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 analysed, but Coati needs "
|
||||
"them for correct analysis.",
|
||||
"Header Search Paths define where additional headers, 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 analysed, but Coati needs "
|
||||
"them for correct analysis.\n\n"
|
||||
"Header Search Paths defined here will be used for all projects."
|
||||
);
|
||||
|
||||
m_subPaths = new QtProjectWizzardContentPathsHeaderSearchGlobal(settings, window);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsHeaderSearch::loadPaths()
|
||||
{
|
||||
m_list->setList(m_settings->getHeaderSearchPaths());
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsHeaderSearch::savePaths()
|
||||
{
|
||||
m_settings->setHeaderSearchPaths(m_list->getList());
|
||||
}
|
||||
|
||||
QtProjectWizzardContentPathsHeaderSearchGlobal::QtProjectWizzardContentPathsHeaderSearchGlobal(
|
||||
ProjectSettings* settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContentPaths(settings, window)
|
||||
{
|
||||
setInfo(
|
||||
"Global Header Search Paths",
|
||||
"Header Search Paths for all projects.",
|
||||
"Header Search Paths define where additional headers, 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 analysed, but Coati needs "
|
||||
"them for correct analysis.\n\n"
|
||||
"Header Search Paths defined here will be used for all projects."
|
||||
);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsHeaderSearchGlobal::loadPaths()
|
||||
{
|
||||
m_list->setList(ApplicationSettings::getInstance()->getHeaderSearchPaths());
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsHeaderSearchGlobal::savePaths()
|
||||
{
|
||||
ApplicationSettings::getInstance()->setHeaderSearchPaths(m_list->getList());
|
||||
}
|
||||
|
||||
|
||||
QtProjectWizzardContentPathsFrameworkSearch::QtProjectWizzardContentPathsFrameworkSearch(
|
||||
ProjectSettings* settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContentPaths(settings, window)
|
||||
{
|
||||
setInfo(
|
||||
"Framework Search Paths",
|
||||
"Framework Search Paths define where MacOS framework containers, that your project depends on, are found.",
|
||||
"Framework Search Paths define where MacOS framework containers, that your project depends on, are found.\n\n"
|
||||
"Framework Search Paths defined here will be used for all projects."
|
||||
);
|
||||
|
||||
m_subPaths = new QtProjectWizzardContentPathsFrameworkSearchGlobal(settings, window);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsFrameworkSearch::loadPaths()
|
||||
{
|
||||
m_list->setList(m_settings->getFrameworkSearchPaths());
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsFrameworkSearch::savePaths()
|
||||
{
|
||||
m_settings->setFrameworkSearchPaths(m_list->getList());
|
||||
}
|
||||
|
||||
QtProjectWizzardContentPathsFrameworkSearchGlobal::QtProjectWizzardContentPathsFrameworkSearchGlobal(
|
||||
ProjectSettings* settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContentPaths(settings, window)
|
||||
{
|
||||
setInfo(
|
||||
"Global Framework Search Paths",
|
||||
"Framework Search Paths for all projects",
|
||||
"Framework Search Paths define where MacOS framework containers, that your project depends on, are found.\n\n"
|
||||
"Framework Search Paths defined here will be used for all projects."
|
||||
);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsFrameworkSearchGlobal::loadPaths()
|
||||
{
|
||||
m_list->setList(ApplicationSettings::getInstance()->getFrameworkSearchPaths());
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsFrameworkSearchGlobal::savePaths()
|
||||
{
|
||||
ApplicationSettings::getInstance()->setFrameworkSearchPaths(m_list->getList());
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_PATHS_H
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_PATHS_H
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QtDirectoryListBox;
|
||||
|
||||
class QtHelpButton
|
||||
: public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtHelpButton(const QString& helpText, QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void handleHelpPress();
|
||||
|
||||
private:
|
||||
QString m_helpText;
|
||||
};
|
||||
|
||||
|
||||
class QtProjectWizzardContentPaths
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
public:
|
||||
QtProjectWizzardContentPaths(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtSettingsWindow implementation
|
||||
virtual void populateWindow(QWidget* widget) override;
|
||||
void populateLayout(QVBoxLayout* layout);
|
||||
virtual void populateForm(QFormLayout* layout) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
virtual bool check() override;
|
||||
|
||||
virtual void loadPaths();
|
||||
virtual void savePaths();
|
||||
virtual bool checkPaths();
|
||||
|
||||
protected:
|
||||
void setInfo(const QString& title, const QString& description, const QString& help);
|
||||
|
||||
QtDirectoryListBox* m_list;
|
||||
QtProjectWizzardContentPaths* m_subPaths;
|
||||
|
||||
private:
|
||||
QString m_titleString;
|
||||
QString m_descriptionString;
|
||||
QString m_helpString;
|
||||
};
|
||||
|
||||
|
||||
class QtProjectWizzardContentPathsSource
|
||||
: public QtProjectWizzardContentPaths
|
||||
{
|
||||
public:
|
||||
QtProjectWizzardContentPathsSource(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void loadPaths() override;
|
||||
virtual void savePaths() override;
|
||||
virtual bool checkPaths() override;
|
||||
};
|
||||
|
||||
|
||||
class QtProjectWizzardContentPathsHeaderSearch
|
||||
: public QtProjectWizzardContentPaths
|
||||
{
|
||||
public:
|
||||
QtProjectWizzardContentPathsHeaderSearch(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void loadPaths() override;
|
||||
virtual void savePaths() override;
|
||||
};
|
||||
|
||||
class QtProjectWizzardContentPathsHeaderSearchGlobal
|
||||
: public QtProjectWizzardContentPaths
|
||||
{
|
||||
public:
|
||||
QtProjectWizzardContentPathsHeaderSearchGlobal(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void loadPaths() override;
|
||||
virtual void savePaths() override;
|
||||
};
|
||||
|
||||
|
||||
class QtProjectWizzardContentPathsFrameworkSearch
|
||||
: public QtProjectWizzardContentPaths
|
||||
{
|
||||
public:
|
||||
QtProjectWizzardContentPathsFrameworkSearch(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void loadPaths() override;
|
||||
virtual void savePaths() override;
|
||||
};
|
||||
|
||||
class QtProjectWizzardContentPathsFrameworkSearchGlobal
|
||||
: public QtProjectWizzardContentPaths
|
||||
{
|
||||
public:
|
||||
QtProjectWizzardContentPathsFrameworkSearchGlobal(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void loadPaths() override;
|
||||
virtual void savePaths() override;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_PATHS_H
|
||||
@@ -0,0 +1,75 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSelect.h"
|
||||
|
||||
#include <QButtonGroup>
|
||||
#include <QFormLayout>
|
||||
#include <QMessageBox>
|
||||
#include <QLabel>
|
||||
#include <QRadioButton>
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
|
||||
|
||||
QtProjectWizzardContentSelect::QtProjectWizzardContentSelect(ProjectSettings* settings, QtProjectWizzardWindow* window)
|
||||
: QtProjectWizzardContent(settings, window)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSelect::populateWindow(QWidget* widget)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(widget);
|
||||
|
||||
QLabel* title = new QLabel("project type");
|
||||
title->setObjectName("label");
|
||||
layout->addWidget(title);
|
||||
|
||||
QRadioButton* a = new QRadioButton("empty");
|
||||
QRadioButton* b = new QRadioButton("from Visual Studio Solution");
|
||||
QRadioButton* c = new QRadioButton("from Compilation Database");
|
||||
|
||||
m_buttons = new QButtonGroup(this);
|
||||
m_buttons->addButton(a);
|
||||
m_buttons->addButton(b);
|
||||
m_buttons->addButton(c);
|
||||
|
||||
m_buttons->setId(a, PROJECT_EMPTY);
|
||||
m_buttons->setId(b, PROJECT_CDB);
|
||||
m_buttons->setId(c, PROJECT_VS);
|
||||
|
||||
connect(m_buttons, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),
|
||||
[this](int id)
|
||||
{
|
||||
m_window->enableNext();
|
||||
}
|
||||
);
|
||||
|
||||
layout->addWidget(a);
|
||||
layout->addWidget(b);
|
||||
layout->addWidget(c);
|
||||
|
||||
layout->addStretch();
|
||||
|
||||
widget->setLayout(layout);
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentSelect::check()
|
||||
{
|
||||
if (m_buttons->checkedId() == -1)
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Please choose how you want to create your project.");
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
ProjectType type;
|
||||
|
||||
switch (m_buttons->checkedId())
|
||||
{
|
||||
case 0: type = PROJECT_EMPTY; break;
|
||||
case 1: type = PROJECT_CDB; break;
|
||||
case 2: type = PROJECT_VS; break;
|
||||
}
|
||||
|
||||
emit selected(type);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_SELECT_H
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_SELECT_H
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QButtonGroup;
|
||||
|
||||
class QtProjectWizzardContentSelect
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum ProjectType : int
|
||||
{
|
||||
PROJECT_EMPTY = 0,
|
||||
PROJECT_CDB = 1,
|
||||
PROJECT_VS = 2
|
||||
};
|
||||
|
||||
QtProjectWizzardContentSelect(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
signals:
|
||||
void selected(QtProjectWizzardContentSelect::ProjectType);
|
||||
|
||||
protected:
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populateWindow(QWidget* widget) override;
|
||||
virtual bool check() override;
|
||||
|
||||
private:
|
||||
QButtonGroup* m_buttons;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_SELECT_H
|
||||
@@ -0,0 +1,69 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h"
|
||||
|
||||
#include <QButtonGroup>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QRadioButton>
|
||||
|
||||
QtProjectWizzardContentSimple::QtProjectWizzardContentSimple(ProjectSettings* settings, QtProjectWizzardWindow* window)
|
||||
: QtProjectWizzardContent(settings, window)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSimple::populateWindow(QWidget* widget)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(widget);
|
||||
|
||||
QLabel* title = new QLabel("simple setup");
|
||||
title->setObjectName("label");
|
||||
layout->addWidget(title);
|
||||
|
||||
QLabel* text = new QLabel(
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do "
|
||||
"eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut "
|
||||
"enim ad minim veniam, quis nostrud exercitation ullamco laboris "
|
||||
"nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in "
|
||||
"reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla "
|
||||
"pariatur. Excepteur sint occaecat cupidatat non proident, sunt in "
|
||||
"culpa qui officia deserunt mollit anim id est laborum."
|
||||
);
|
||||
text->setWordWrap(true);
|
||||
layout->addWidget(text);
|
||||
|
||||
QRadioButton* a = new QRadioButton("simple setup");
|
||||
QRadioButton* b = new QRadioButton("advanced setup");
|
||||
|
||||
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->enableNext();
|
||||
}
|
||||
);
|
||||
|
||||
layout->addWidget(a);
|
||||
layout->addWidget(b);
|
||||
|
||||
layout->addStretch();
|
||||
|
||||
widget->setLayout(layout);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSimple::load()
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSimple::save()
|
||||
{
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentSimple::check()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_SIMPLE_H
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_SIMPLE_H
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QButtonGroup;
|
||||
|
||||
class QtProjectWizzardContentSimple
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentSimple(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
protected:
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populateWindow(QWidget* widget) override;
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
virtual bool check() override;
|
||||
|
||||
private:
|
||||
QButtonGroup* m_buttons;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_SIMPLE_H
|
||||
@@ -0,0 +1,78 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSummary.h"
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QSysInfo>
|
||||
|
||||
QtProjectWizzardContentSummary::QtProjectWizzardContentSummary(ProjectSettings* settings, QtProjectWizzardWindow* window)
|
||||
: QtProjectWizzardContent(settings, window)
|
||||
, m_data(nullptr)
|
||||
, m_source(nullptr)
|
||||
, m_headerSearch(nullptr)
|
||||
, m_frameworkSearch(nullptr)
|
||||
{
|
||||
m_data = new QtProjectWizzardContentData(settings, window);
|
||||
m_source = new QtProjectWizzardContentPathsSource(settings, window);
|
||||
m_headerSearch = new QtProjectWizzardContentPathsHeaderSearch(settings, window);
|
||||
|
||||
if (QSysInfo::macVersion() != QSysInfo::MV_None)
|
||||
{
|
||||
m_frameworkSearch = new QtProjectWizzardContentPathsFrameworkSearch(settings, window);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSummary::populateWindow(QWidget* widget)
|
||||
{
|
||||
QFormLayout* layout = new QFormLayout();
|
||||
layout->setContentsMargins(10, 10, 10, 10);
|
||||
layout->setHorizontalSpacing(20);
|
||||
|
||||
m_data->populateForm(layout);
|
||||
m_source->populateForm(layout);
|
||||
m_headerSearch->populateForm(layout);
|
||||
|
||||
if (m_frameworkSearch)
|
||||
{
|
||||
m_frameworkSearch->populateForm(layout);
|
||||
}
|
||||
|
||||
widget->setLayout(layout);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSummary::windowReady()
|
||||
{
|
||||
m_window->updateTitle("NEW PROJECT WIZZARD - SUMMARY");
|
||||
m_window->updateDoneButton("Create");
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSummary::load()
|
||||
{
|
||||
m_data->load();
|
||||
m_source->load();
|
||||
m_headerSearch->load();
|
||||
|
||||
if (m_frameworkSearch)
|
||||
{
|
||||
m_frameworkSearch->load();
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSummary::save()
|
||||
{
|
||||
m_data->save();
|
||||
m_source->save();
|
||||
m_headerSearch->save();
|
||||
|
||||
if (m_frameworkSearch)
|
||||
{
|
||||
m_frameworkSearch->save();
|
||||
}
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentSummary::check()
|
||||
{
|
||||
return
|
||||
m_data->check() &&
|
||||
m_source->check() &&
|
||||
m_headerSearch->check() &&
|
||||
(!m_frameworkSearch || m_frameworkSearch->check());
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_SUMMARY_H
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_SUMMARY_H
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentData.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
|
||||
|
||||
class QtProjectWizzardContentSummary
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
public:
|
||||
QtProjectWizzardContentSummary(ProjectSettings* settings, QtProjectWizzardWindow* window);
|
||||
|
||||
protected:
|
||||
// QtProjectContentWindow implementation
|
||||
virtual void populateWindow(QWidget* widget);
|
||||
virtual void windowReady();
|
||||
virtual void load();
|
||||
virtual void save();
|
||||
virtual bool check();
|
||||
|
||||
private:
|
||||
QtProjectWizzardContentData* m_data;
|
||||
QtProjectWizzardContentPathsSource* m_source;
|
||||
QtProjectWizzardContentPathsHeaderSearch* m_headerSearch;
|
||||
QtProjectWizzardContentPathsFrameworkSearch* m_frameworkSearch;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_SUMMARY_H
|
||||
@@ -0,0 +1,97 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
QtProjectWizzardWindow::QtProjectWizzardWindow(QWidget *parent)
|
||||
: QtSettingsWindow(parent)
|
||||
, m_content(nullptr)
|
||||
, m_previousButton(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
QtProjectWizzardContent* QtProjectWizzardWindow::content() const
|
||||
{
|
||||
return m_content;
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::setContent(QtProjectWizzardContent* content)
|
||||
{
|
||||
m_content = content;
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::setup()
|
||||
{
|
||||
setupForm();
|
||||
|
||||
updateTitle("NEW PROJECT WIZZARD");
|
||||
updateDoneButton("Next");
|
||||
|
||||
m_previousButton = new QPushButton("Previous");
|
||||
m_previousButton->setObjectName("windowButton");
|
||||
connect(m_previousButton, SIGNAL(clicked()), this, SLOT(handlePreviousButtonPress()));
|
||||
|
||||
m_buttonsLayout->insertWidget(2, m_previousButton);
|
||||
m_buttonsLayout->insertSpacing(3, 3);
|
||||
|
||||
m_content->windowReady();
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::populateWindow(QWidget* widget)
|
||||
{
|
||||
m_content->populateWindow(widget);
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::enableNext()
|
||||
{
|
||||
if (m_doneButton)
|
||||
{
|
||||
m_doneButton->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::disableNext()
|
||||
{
|
||||
if (m_doneButton)
|
||||
{
|
||||
m_doneButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::disablePrevious()
|
||||
{
|
||||
if (m_previousButton)
|
||||
{
|
||||
m_previousButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::hidePrevious()
|
||||
{
|
||||
if (m_previousButton)
|
||||
{
|
||||
m_previousButton->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::handleCancelButtonPress()
|
||||
{
|
||||
emit canceled();
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::handleUpdateButtonPress()
|
||||
{
|
||||
if (m_content->check())
|
||||
{
|
||||
m_content->save();
|
||||
emit next();
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::handlePreviousButtonPress()
|
||||
{
|
||||
m_content->save();
|
||||
|
||||
emit previous();
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_WINDOW_H
|
||||
#define QT_PROJECT_WIZZARD_WINDOW_H
|
||||
|
||||
#include "qt/window/QtSettingsWindow.h"
|
||||
#include "settings/ProjectSettings.h"
|
||||
|
||||
class QPushButton;
|
||||
class QtProjectWizzardContent;
|
||||
|
||||
class QtProjectWizzardWindow
|
||||
: public QtSettingsWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
signals:
|
||||
void next();
|
||||
void previous();
|
||||
|
||||
public:
|
||||
QtProjectWizzardWindow(QWidget *parent);
|
||||
|
||||
QtProjectWizzardContent* content() const;
|
||||
void setContent(QtProjectWizzardContent* content);
|
||||
|
||||
// QtSettingsWindow implementation
|
||||
virtual void setup() override;
|
||||
virtual void populateWindow(QWidget* widget) override;
|
||||
|
||||
void enableNext();
|
||||
void disableNext();
|
||||
void disablePrevious();
|
||||
void hidePrevious();
|
||||
|
||||
private:
|
||||
QtProjectWizzardContent* m_content;
|
||||
QPushButton* m_previousButton;
|
||||
|
||||
private slots:
|
||||
void handleCancelButtonPress();
|
||||
void handleUpdateButtonPress();
|
||||
void handlePreviousButtonPress();
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_WINDOW_H
|
||||
Reference in New Issue
Block a user