forked from qt-creator/qt-creator
Utils: Use more FilePath in ProjectIntroPage
Change-Id: I0cdc18f4b88012f00d6403125c7bd3ba0b6d80df Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -62,7 +62,7 @@ public:
|
|||||||
bool m_complete = false;
|
bool m_complete = false;
|
||||||
QRegularExpressionValidator m_projectNameValidator;
|
QRegularExpressionValidator m_projectNameValidator;
|
||||||
bool m_forceSubProject = false;
|
bool m_forceSubProject = false;
|
||||||
QStringList m_projectDirectories;
|
FilePaths m_projectDirectories;
|
||||||
};
|
};
|
||||||
|
|
||||||
ProjectIntroPage::ProjectIntroPage(QWidget *parent) :
|
ProjectIntroPage::ProjectIntroPage(QWidget *parent) :
|
||||||
@@ -157,7 +157,7 @@ bool ProjectIntroPage::validate()
|
|||||||
int index = d->m_ui.projectComboBox->currentIndex();
|
int index = d->m_ui.projectComboBox->currentIndex();
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
return false;
|
return false;
|
||||||
d->m_ui.pathChooser->setPath(d->m_projectDirectories.at(index));
|
d->m_ui.pathChooser->setFilePath(d->m_projectDirectories.at(index));
|
||||||
}
|
}
|
||||||
// Validate and display status
|
// Validate and display status
|
||||||
if (!d->m_ui.pathChooser->isValid()) {
|
if (!d->m_ui.pathChooser->isValid()) {
|
||||||
@@ -230,7 +230,7 @@ void ProjectIntroPage::setProjectList(const QStringList &projectList)
|
|||||||
d->m_ui.projectComboBox->addItems(projectList);
|
d->m_ui.projectComboBox->addItems(projectList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectIntroPage::setProjectDirectories(const QStringList &directoryList)
|
void ProjectIntroPage::setProjectDirectories(const FilePaths &directoryList)
|
||||||
{
|
{
|
||||||
d->m_projectDirectories = directoryList;
|
d->m_projectDirectories = directoryList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public:
|
|||||||
bool forceSubProject() const;
|
bool forceSubProject() const;
|
||||||
void setForceSubProject(bool force);
|
void setForceSubProject(bool force);
|
||||||
void setProjectList(const QStringList &projectList);
|
void setProjectList(const QStringList &projectList);
|
||||||
void setProjectDirectories(const QStringList &directoryList);
|
void setProjectDirectories(const Utils::FilePaths &directoryList);
|
||||||
int projectIndex() const;
|
int projectIndex() const;
|
||||||
|
|
||||||
bool validateProjectName(const QString &name, QString *errorMessage);
|
bool validateProjectName(const QString &name, QString *errorMessage);
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "baseprojectwizarddialog.h"
|
#include "baseprojectwizarddialog.h"
|
||||||
|
|
||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <utils/fileutils.h>
|
|
||||||
#include <utils/projectintropage.h>
|
#include <utils/projectintropage.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -45,28 +44,25 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
struct BaseProjectWizardDialogPrivate {
|
struct BaseProjectWizardDialogPrivate
|
||||||
explicit BaseProjectWizardDialogPrivate(Utils::ProjectIntroPage *page, int id = -1);
|
{
|
||||||
|
explicit BaseProjectWizardDialogPrivate(ProjectIntroPage *page, int id = -1)
|
||||||
|
: desiredIntroPageId(id), introPage(page)
|
||||||
|
{}
|
||||||
|
|
||||||
const int desiredIntroPageId;
|
const int desiredIntroPageId;
|
||||||
Utils::ProjectIntroPage *introPage;
|
ProjectIntroPage *introPage;
|
||||||
int introPageId;
|
int introPageId = -1;
|
||||||
Utils::Id selectedPlatform;
|
Id selectedPlatform;
|
||||||
QSet<Utils::Id> requiredFeatureSet;
|
QSet<Id> requiredFeatureSet;
|
||||||
};
|
};
|
||||||
|
|
||||||
BaseProjectWizardDialogPrivate::BaseProjectWizardDialogPrivate(Utils::ProjectIntroPage *page, int id) :
|
|
||||||
desiredIntroPageId(id),
|
|
||||||
introPage(page),
|
|
||||||
introPageId(-1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
|
BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
const Core::WizardDialogParameters ¶meters) :
|
const Core::WizardDialogParameters ¶meters) :
|
||||||
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
|
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
|
||||||
d(std::make_unique<BaseProjectWizardDialogPrivate>(new Utils::ProjectIntroPage))
|
d(std::make_unique<BaseProjectWizardDialogPrivate>(new ProjectIntroPage))
|
||||||
{
|
{
|
||||||
setFilePath(FilePath::fromString(parameters.defaultPath()));
|
setFilePath(FilePath::fromString(parameters.defaultPath()));
|
||||||
setSelectedPlatform(parameters.selectedPlatform());
|
setSelectedPlatform(parameters.selectedPlatform());
|
||||||
@@ -130,7 +126,7 @@ void BaseProjectWizardDialog::setProjectList(const QStringList &projectList)
|
|||||||
d->introPage->setProjectList(projectList);
|
d->introPage->setProjectList(projectList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseProjectWizardDialog::setProjectDirectories(const QStringList &directories)
|
void BaseProjectWizardDialog::setProjectDirectories(const FilePaths &directories)
|
||||||
{
|
{
|
||||||
d->introPage->setProjectDirectories(directories);
|
d->introPage->setProjectDirectories(directories);
|
||||||
}
|
}
|
||||||
@@ -156,7 +152,7 @@ bool BaseProjectWizardDialog::validateCurrentPage()
|
|||||||
return Core::BaseFileWizard::validateCurrentPage();
|
return Core::BaseFileWizard::validateCurrentPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::ProjectIntroPage *BaseProjectWizardDialog::introPage() const
|
ProjectIntroPage *BaseProjectWizardDialog::introPage() const
|
||||||
{
|
{
|
||||||
return d->introPage;
|
return d->introPage;
|
||||||
}
|
}
|
||||||
@@ -180,26 +176,26 @@ QString BaseProjectWizardDialog::uniqueProjectName(const QString &path)
|
|||||||
|
|
||||||
void BaseProjectWizardDialog::addExtensionPages(const QList<QWizardPage *> &wizardPageList)
|
void BaseProjectWizardDialog::addExtensionPages(const QList<QWizardPage *> &wizardPageList)
|
||||||
{
|
{
|
||||||
foreach (QWizardPage *p,wizardPageList)
|
for (QWizardPage *p : wizardPageList)
|
||||||
addPage(p);
|
addPage(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::Id BaseProjectWizardDialog::selectedPlatform() const
|
Id BaseProjectWizardDialog::selectedPlatform() const
|
||||||
{
|
{
|
||||||
return d->selectedPlatform;
|
return d->selectedPlatform;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseProjectWizardDialog::setSelectedPlatform(Utils::Id platform)
|
void BaseProjectWizardDialog::setSelectedPlatform(Id platform)
|
||||||
{
|
{
|
||||||
d->selectedPlatform = platform;
|
d->selectedPlatform = platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<Utils::Id> BaseProjectWizardDialog::requiredFeatures() const
|
QSet<Id> BaseProjectWizardDialog::requiredFeatures() const
|
||||||
{
|
{
|
||||||
return d->requiredFeatureSet;
|
return d->requiredFeatureSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseProjectWizardDialog::setRequiredFeatures(const QSet<Utils::Id> &featureSet)
|
void BaseProjectWizardDialog::setRequiredFeatures(const QSet<Id> &featureSet)
|
||||||
{
|
{
|
||||||
d->requiredFeatureSet = featureSet;
|
d->requiredFeatureSet = featureSet;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,12 +30,11 @@
|
|||||||
#include <coreplugin/basefilewizard.h>
|
#include <coreplugin/basefilewizard.h>
|
||||||
#include <coreplugin/basefilewizardfactory.h>
|
#include <coreplugin/basefilewizardfactory.h>
|
||||||
|
|
||||||
|
#include <utils/filepath.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils { class ProjectIntroPage; }
|
||||||
class FilePath;
|
|
||||||
class ProjectIntroPage;
|
|
||||||
} // Utils
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
@@ -68,7 +67,7 @@ public:
|
|||||||
void setFilePath(const Utils::FilePath &path);
|
void setFilePath(const Utils::FilePath &path);
|
||||||
void setProjectName(const QString &name);
|
void setProjectName(const QString &name);
|
||||||
void setProjectList(const QStringList &projectList);
|
void setProjectList(const QStringList &projectList);
|
||||||
void setProjectDirectories(const QStringList &directories);
|
void setProjectDirectories(const Utils::FilePaths &directories);
|
||||||
void setForceSubProject(bool force);
|
void setForceSubProject(bool force);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
Reference in New Issue
Block a user