Commit 0af52c6b authored by Daniel Teske's avatar Daniel Teske
Browse files

Simplfy code in ProjectLoadWizard



Change-Id: Id77ff7681c31ccca5778bbe1eed5a341523c03c1
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 6820f22b
......@@ -53,7 +53,12 @@ ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::W
setWindowTitle(tr("Project Setup"));
setupTargetPage();
m_targetSetupPage = new TargetSetupPage(this);
m_targetSetupPage->setProFilePath(m_project->file()->fileName());
m_targetSetupPage->setImportSearch(true);
resize(900, 450);
addPage(m_targetSetupPage);
setOption(QWizard::NoCancelButton, false);
setOption(QWizard::NoDefaultButton, false);
......@@ -69,16 +74,6 @@ ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::W
#endif
}
// We don't want to actually show the dialog if we don't show the import page
// We used to simply call ::exec() on the dialog
void ProjectLoadWizard::execDialog()
{
if (!pageIds().isEmpty())
exec();
else
done(QDialog::Accepted);
}
ProjectLoadWizard::~ProjectLoadWizard()
{
}
......@@ -86,28 +81,12 @@ ProjectLoadWizard::~ProjectLoadWizard()
void ProjectLoadWizard::done(int result)
{
QWizard::done(result);
// This normally happens on showing the final page, but since we
// don't show it anymore, do it here
if (result == Accepted)
applySettings();
}
void ProjectLoadWizard::setupTargetPage()
{
if (m_targetSetupPage)
return;
m_targetSetupPage = new TargetSetupPage(this);
m_targetSetupPage->setProFilePath(m_project->file()->fileName());
m_targetSetupPage->setImportSearch(true);
resize(900, 450);
addPage(m_targetSetupPage);
}
void ProjectLoadWizard::applySettings()
{
Q_ASSERT(m_targetSetupPage);
m_targetSetupPage->setupProject(m_project);
}
......@@ -48,11 +48,8 @@ public:
explicit ProjectLoadWizard(Qt4Project *project, QWidget * parent = 0, Qt::WindowFlags flags = 0);
virtual ~ProjectLoadWizard();
virtual void done(int result);
void execDialog();
private:
void setupTargetPage();
void applySettings();
Qt4Project *m_project;
......
......@@ -375,8 +375,10 @@ bool Qt4Project::fromMap(const QVariantMap &map)
}
// Add buildconfigurations so we can parse the pro-files.
if (targets().isEmpty())
addDefaultBuild();
if (targets().isEmpty()) {
ProjectLoadWizard wizard(this);
wizard.exec();
}
if (targets().isEmpty()) {
qWarning() << "Unable to create targets!";
......@@ -931,16 +933,6 @@ QList<ProjectExplorer::Project*> Qt4Project::dependsOn()
return QList<Project *>();
}
void Qt4Project::addDefaultBuild()
{
// TODO this could probably refactored
// That is the ProjectLoadWizard divided into useful bits
// and this code then called here, instead of that strange forwarding
// to a wizard, which doesn't even show up
ProjectLoadWizard wizard(this);
wizard.execDialog();
}
void Qt4Project::proFileParseError(const QString &errorMessage)
{
Core::ICore::instance()->messageManager()->printToOutputPanePopup(errorMessage);
......
......@@ -171,8 +171,6 @@ private:
static bool equalFileList(const QStringList &a, const QStringList &b);
void addDefaultBuild();
static QString qmakeVarName(ProjectExplorer::FileType type);
Qt4Manager *m_manager;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment