ui: Fixed path checking in project setup wizzard

This commit is contained in:
Eberhard Graether
2016-04-21 16:11:00 +02:00
parent b5bcabb494
commit 526f966356
7 changed files with 35 additions and 29 deletions
@@ -517,6 +517,13 @@ void QtProjectWizzard::headerPathsCDBDone()
void QtProjectWizzard::showFiles(QtProjectWizzardContent* content)
{
QWidget* widget = m_windowStack.getTopWindow();
if (widget)
{
QtProjectWizzardWindow* win = dynamic_cast<QtProjectWizzardWindow*>(widget);
win->content()->save();
}
QtProjectWizzardWindow* window = createPopupWithContent<QtProjectWizzardContentSourceList>();
dynamic_cast<QtProjectWizzardContentSourceList*>(window->content())->showFilesFromContent(content);
}
@@ -591,7 +598,7 @@ void QtProjectWizzard::showSummary()
void QtProjectWizzard::createProject()
{
std::string path = m_settings.getProjectFileLocation() + "/" + m_settings.getProjectName() + ".coatiproject";
std::string path = m_settings.getProjectFileLocation().str() + "/" + m_settings.getProjectName() + ".coatiproject";
m_settings.save(path);
@@ -129,7 +129,5 @@ QPushButton* QtProjectWizzardContent::addFilesButton(QString name, QGridLayout*
void QtProjectWizzardContent::buttonClicked()
{
save();
emit filesButtonClicked(this);
}
@@ -103,7 +103,7 @@ void QtProjectWizzardContentData::populateForm(QGridLayout* layout, int& row)
void QtProjectWizzardContentData::load()
{
m_projectName->setText(QString::fromStdString(m_settings->getProjectName()));
m_projectFileLocation->setText(QString::fromStdString(m_settings->getProjectFileLocation()));
m_projectFileLocation->setText(QString::fromStdString(m_settings->getProjectFileLocation().str()));
if (m_settings->getLanguage().length() > 0)
{
@@ -97,24 +97,25 @@ bool QtProjectWizzardContentPaths::check()
QString missingPaths;
for (FilePath f : m_list->getList())
{
f = f.expandEnvironmentVariables();
if (!f.exists())
FilePath fi = f.expandEnvironmentVariables();
if (!fi.isAbsolute())
{
if (!missingPaths.isEmpty())
{
missingPaths.append("\n");
}
fi = FilePath(m_settings->getProjectFileLocation()).concat(fi);
}
if (!fi.exists())
{
missingPaths.append("\n");
missingPaths.append(f.str().c_str());
}
}
if (!missingPaths.isEmpty())
{
QMessageBox msgBox;
msgBox.setText("These paths do not exist:\n" + missingPaths);
msgBox.exec();
return false;
}
if (!missingPaths.isEmpty())
{
QMessageBox msgBox;
msgBox.setText("These paths do not exist:" + missingPaths);
msgBox.exec();
return false;
}
return true;
@@ -267,8 +268,7 @@ QStringList QtProjectWizzardContentPathsSource::getSourceFileNames(bool headersO
utility::append(extensions, m_settings->getHeaderExtensions());
std::vector<FileInfo> fileInfos = FileSystem::getFileInfosFromPaths(sourcePaths, extensions);
FilePath projectPath = FilePath(m_settings->getProjectFileLocation());
FilePath projectPath = m_settings->getProjectFileLocation();
QStringList list;
for (const FileInfo& info : fileInfos)
@@ -84,9 +84,10 @@ void QtProjectWizzardWindow::handleNext()
emit next();
}
m_content->save();
if (m_content->check())
{
m_content->save();
emit next();
}
}