src: refactored project wizard file structure
* renamed wizzard to wizard * split QtProjectWizardContentPath into multiple files * split QtProjectWizardContentPaths into multiple files * restructured subdirectories
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
#include "QtProjectWizardContentPath.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "SourceGroupSettings.h"
|
||||
|
||||
QtProjectWizardContentPath::QtProjectWizardContentPath(QtProjectWizardWindow* window)
|
||||
: QtProjectWizardContent(window)
|
||||
, m_makePathRelativeToProjectFileLocation(true)
|
||||
, m_allowEmpty(false)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizardContentPath::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
QLabel* label = createFormLabel(m_titleString);
|
||||
layout->addWidget(label, row, QtProjectWizardWindow::FRONT_COL, Qt::AlignTop);
|
||||
|
||||
if (m_helpString.size() > 0)
|
||||
{
|
||||
addHelpButton(m_titleString, m_helpString, layout, row);
|
||||
}
|
||||
|
||||
m_picker = new QtLocationPicker(this);
|
||||
m_picker->setPickDirectory(true);
|
||||
m_picker->setPlaceholderText(m_placeholderString);
|
||||
|
||||
if (m_makePathRelativeToProjectFileLocation)
|
||||
{
|
||||
m_picker->setRelativeRootDirectory(getSourceGroupSettings()->getProjectDirectoryPath());
|
||||
}
|
||||
|
||||
layout->addWidget(m_picker, row, QtProjectWizardWindow::BACK_COL);
|
||||
row++;
|
||||
}
|
||||
|
||||
bool QtProjectWizardContentPath::check()
|
||||
{
|
||||
QString error;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (m_picker->getText().isEmpty())
|
||||
{
|
||||
if (m_allowEmpty)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
error = "Please define a path at \"" + m_titleString + "\".";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
FilePath path = getSourceGroupSettings()->makePathExpandedAndAbsolute(FilePath(m_picker->getText().toStdWString()));
|
||||
|
||||
if (m_picker->pickDirectory())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!path.exists())
|
||||
{
|
||||
error = "The entered path does not exist at \"" + m_titleString + "\".";
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_fileEndings.find(path.extension()) == m_fileEndings.end())
|
||||
{
|
||||
error = "The entered path does have a correct file ending at \"" + m_titleString + "\".";
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (!error.isEmpty())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(error);
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void QtProjectWizardContentPath::setTitleString(const QString& title)
|
||||
{
|
||||
m_titleString = title;
|
||||
}
|
||||
|
||||
void QtProjectWizardContentPath::setHelpString(const QString& help)
|
||||
{
|
||||
m_helpString = help;
|
||||
}
|
||||
|
||||
void QtProjectWizardContentPath::setPlaceholderString(const QString& placeholder)
|
||||
{
|
||||
m_placeholderString = placeholder;
|
||||
}
|
||||
|
||||
void QtProjectWizardContentPath::setFileEndings(const std::set<std::wstring>& fileEndings)
|
||||
{
|
||||
m_fileEndings = fileEndings;
|
||||
}
|
||||
|
||||
void QtProjectWizardContentPath::setAllowEmpty(bool allowEmpty)
|
||||
{
|
||||
m_allowEmpty = allowEmpty;
|
||||
}
|
||||
Reference in New Issue
Block a user