Commit 719d39d3 authored by Tobias Hunger's avatar Tobias Hunger

Vcs: Remove propertyPages from wizardFactory

Change-Id: If9d3249818b024a1a873fd3f78190379c050ac66
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 0088aec7
......@@ -51,21 +51,9 @@ CloneWizardFactory::CloneWizardFactory()
setDisplayName(tr("Bazaar Clone (Or Branch)"));
}
VcsBase::BaseCheckoutWizard *CloneWizardFactory::create(const QList<QWizardPage *> &parameterPages, QWidget *parent) const
VcsBase::BaseCheckoutWizard *CloneWizardFactory::create(const QString &path, QWidget *parent) const
{
return new CloneWizard(parameterPages, parent);
}
QList<QWizardPage *> CloneWizardFactory::createParameterPages(const QString &path)
{
QList<QWizardPage *> wizardPageList;
const Core::IVersionControl *vc = BazaarPlugin::instance()->versionControl();
if (!vc->isConfigured())
wizardPageList.append(new VcsBase::VcsConfigurationPage(vc));
CloneWizardPage *page = new CloneWizardPage;
page->setPath(path);
wizardPageList.append(page);
return wizardPageList;
return new CloneWizard(path, parent);
}
VcsBase::Command *CloneWizardFactory::createCommand(const QList<QWizardPage *> &parameterPages,
......@@ -116,9 +104,16 @@ VcsBase::Command *CloneWizardFactory::createCommand(const QList<QWizardPage *> &
// CloneWizard:
// --------------------------------------------------------------------
CloneWizard::CloneWizard(const QList<QWizardPage *> &parameterPages, QWidget *parent) :
VcsBase::BaseCheckoutWizard(parameterPages, parent)
CloneWizard::CloneWizard(const QString &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
{
setTitle(tr("Cloning"));
setStartedStatus(tr("Cloning started..."));
const Core::IVersionControl *vc = BazaarPlugin::instance()->versionControl();
if (!vc->isConfigured())
addPage(new VcsBase::VcsConfigurationPage(vc));
CloneWizardPage *page = new CloneWizardPage;
page->setPath(path);
addPage(page);
}
......@@ -45,10 +45,9 @@ class CloneWizardFactory : public VcsBase::BaseCheckoutWizardFactory
public:
CloneWizardFactory();
VcsBase::BaseCheckoutWizard *create(const QList<QWizardPage *> &parameterPages, QWidget *parent = 0) const;
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
private:
QList<QWizardPage *> createParameterPages(const QString &path);
VcsBase::Command *createCommand(const QList<QWizardPage *> &parameterPages,
QString *checkoutPath);
};
......@@ -58,7 +57,7 @@ class CloneWizard : public VcsBase::BaseCheckoutWizard
Q_OBJECT
public:
CloneWizard(const QList<QWizardPage *> &parameterPages, QWidget *parent = 0);
CloneWizard(const QString &path, QWidget *parent = 0);
};
} // namespace Internal
......
......@@ -48,21 +48,9 @@ CheckoutWizardFactory::CheckoutWizardFactory()
setDisplayName(tr("CVS Checkout"));
}
VcsBase::BaseCheckoutWizard *CheckoutWizardFactory::create(const QList<QWizardPage *> &parameterPages, QWidget *parent) const
VcsBase::BaseCheckoutWizard *CheckoutWizardFactory::create(const QString &path, QWidget *parent) const
{
return new CheckoutWizard(parameterPages, parent);
}
QList<QWizardPage*> CheckoutWizardFactory::createParameterPages(const QString &path)
{
QList<QWizardPage*> rc;
const Core::IVersionControl *vc = CvsPlugin::instance()->versionControl();
if (!vc->isConfigured())
rc.append(new VcsBase::VcsConfigurationPage(vc));
CheckoutWizardPage *cwp = new CheckoutWizardPage;
cwp->setPath(path);
rc.push_back(cwp);
return rc;
return new CheckoutWizard(path, parent);
}
VcsBase::Command *CheckoutWizardFactory::createCommand(const QList<QWizardPage*> &parameterPages,
......@@ -94,9 +82,16 @@ VcsBase::Command *CheckoutWizardFactory::createCommand(const QList<QWizardPage*>
// CheckoutWizard:
// --------------------------------------------------------------------
CheckoutWizard::CheckoutWizard(const QList<QWizardPage *> &parameterPages, QWidget *parent) :
VcsBase::BaseCheckoutWizard(parameterPages, parent)
{ }
CheckoutWizard::CheckoutWizard(const QString &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
{
const Core::IVersionControl *vc = CvsPlugin::instance()->versionControl();
if (!vc->isConfigured())
addPage(new VcsBase::VcsConfigurationPage(vc));
CheckoutWizardPage *cwp = new CheckoutWizardPage;
cwp->setPath(path);
addPage(cwp);
}
} // namespace Internal
} // namespace Cvs
......@@ -43,11 +43,10 @@ class CheckoutWizardFactory : public VcsBase::BaseCheckoutWizardFactory
public:
CheckoutWizardFactory();
VcsBase::BaseCheckoutWizard *create(const QList<QWizardPage *> &parameterPages, QWidget *parent = 0) const;
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
private:
// BaseCheckoutWizard
QList<QWizardPage*> createParameterPages(const QString &path);
VcsBase::Command *createCommand(const QList<QWizardPage*> &parameterPage,
QString *checkoutPath);
};
......@@ -57,7 +56,7 @@ class CheckoutWizard : public VcsBase::BaseCheckoutWizard
Q_OBJECT
public:
CheckoutWizard(const QList<QWizardPage *> &parameterPages, QWidget *parent = 0);
CheckoutWizard(const QString &path, QWidget *parent = 0);
};
} // namespace Internal
......
......@@ -48,21 +48,9 @@ CloneWizardFactory::CloneWizardFactory()
setDisplayName(tr("Git Repository Clone"));
}
VcsBase::BaseCheckoutWizard *CloneWizardFactory::create(const QList<QWizardPage *> &parameterPages, QWidget *parent) const
VcsBase::BaseCheckoutWizard *CloneWizardFactory::create(const QString &path, QWidget *parent) const
{
return new CloneWizard(parameterPages, parent);
}
QList<QWizardPage*> CloneWizardFactory::createParameterPages(const QString &path)
{
QList<QWizardPage*> rc;
const Internal::GitVersionControl *vc = Internal::GitPlugin::instance()->gitVersionControl();
if (!vc->isConfigured())
rc.append(new VcsBase::VcsConfigurationPage(vc));
CloneWizardPage *cwp = new CloneWizardPage;
cwp->setPath(path);
rc.push_back(cwp);
return rc;
return new CloneWizard(path, parent);
}
VcsBase::Command *CloneWizardFactory::createCommand(const QList<QWizardPage*> &parameterPages,
......@@ -83,11 +71,18 @@ VcsBase::Command *CloneWizardFactory::createCommand(const QList<QWizardPage*> &p
// CloneWizard:
// --------------------------------------------------------------------
CloneWizard::CloneWizard(const QList<QWizardPage *> &parameterPages, QWidget *parent) :
VcsBase::BaseCheckoutWizard(parameterPages, parent)
CloneWizard::CloneWizard(const QString &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
{
setTitle(tr("Cloning"));
setStartedStatus(tr("Cloning started..."));
const Internal::GitVersionControl *vc = Internal::GitPlugin::instance()->gitVersionControl();
if (!vc->isConfigured())
addPage(new VcsBase::VcsConfigurationPage(vc));
CloneWizardPage *cwp = new CloneWizardPage;
cwp->setPath(path);
addPage(cwp);
}
} // namespace Internal
......
......@@ -43,11 +43,10 @@ class CloneWizardFactory : public VcsBase::BaseCheckoutWizardFactory
public:
CloneWizardFactory();
VcsBase::BaseCheckoutWizard *create(const QList<QWizardPage *> &parameterPages, QWidget *parent = 0) const;
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
private:
// BaseCheckoutWizard
QList<QWizardPage*> createParameterPages(const QString &path);
VcsBase::Command *createCommand(const QList<QWizardPage*> &parameterPages,
QString *checkoutPath);
};
......@@ -57,7 +56,7 @@ class CloneWizard : public VcsBase::BaseCheckoutWizard
Q_OBJECT
public:
CloneWizard(const QList<QWizardPage *> &parameterPages, QWidget *parent = 0);
CloneWizard(const QString &path, QWidget *parent = 0);
};
} // namespace Internal
......
......@@ -77,26 +77,9 @@ GitoriousCloneWizardFactory::GitoriousCloneWizardFactory()
setDisplayName(tr("Gitorious Repository Clone"));
}
VcsBase::BaseCheckoutWizard *GitoriousCloneWizardFactory::create(const QList<QWizardPage *> &parameterPages, QWidget *parent) const
VcsBase::BaseCheckoutWizard *GitoriousCloneWizardFactory::create(const QString &path, QWidget *parent) const
{
return new GitoriousCloneWizard(parameterPages, parent);
}
QList<QWizardPage*> GitoriousCloneWizardFactory::createParameterPages(const QString &path)
{
QList<QWizardPage*> rc;
const Core::IVersionControl *vc = Git::Internal::GitPlugin::instance()->versionControl();
if (!vc->isConfigured())
rc.append(new VcsBase::VcsConfigurationPage(vc));
GitoriousHostWizardPage *hostPage = new GitoriousHostWizardPage;
GitoriousProjectWizardPage *projectPage = new GitoriousProjectWizardPage(hostPage);
GitoriousRepositoryWizardPage *repoPage = new GitoriousRepositoryWizardPage(projectPage);
GitoriousCloneWizardPage *clonePage = new GitoriousCloneWizardPage(repoPage);
clonePage->setPath(path);
rc << hostPage << projectPage << repoPage << clonePage;
return rc;
return new GitoriousCloneWizard(path, parent);
}
VcsBase::Command *GitoriousCloneWizardFactory::createCommand(const QList<QWizardPage*> &parameterPages,
......@@ -115,9 +98,27 @@ VcsBase::Command *GitoriousCloneWizardFactory::createCommand(const QList<QWizard
// GitoriousCloneWizard:
// --------------------------------------------------------------------
GitoriousCloneWizard::GitoriousCloneWizard(const QList<QWizardPage *> &parameterPages, QWidget *parent) :
VcsBase::BaseCheckoutWizard(parameterPages, parent)
{ }
GitoriousCloneWizard::GitoriousCloneWizard(const QString &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
{
setTitle(tr("Cloning"));
setStartedStatus(tr("Cloning started..."));
const Core::IVersionControl *vc = Git::Internal::GitPlugin::instance()->versionControl();
if (!vc->isConfigured())
addPage(new VcsBase::VcsConfigurationPage(vc));
GitoriousHostWizardPage *hostPage = new GitoriousHostWizardPage;
GitoriousProjectWizardPage *projectPage = new GitoriousProjectWizardPage(hostPage);
GitoriousRepositoryWizardPage *repoPage = new GitoriousRepositoryWizardPage(projectPage);
GitoriousCloneWizardPage *clonePage = new GitoriousCloneWizardPage(repoPage);
clonePage->setPath(path);
addPage(hostPage);
addPage(projectPage);
addPage(repoPage);
addPage(clonePage);
}
} // namespace Internal
} // namespace Gitorius
......@@ -45,11 +45,10 @@ class GitoriousCloneWizardFactory : public VcsBase::BaseCheckoutWizardFactory
public:
GitoriousCloneWizardFactory();
VcsBase::BaseCheckoutWizard *create(const QList<QWizardPage *> &parameterPages, QWidget *parent = 0) const;
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
private:
// BaseCheckoutWizard
QList<QWizardPage*> createParameterPages(const QString &path);
VcsBase::Command *createCommand(const QList<QWizardPage*> &parameterPages,
QString *checkoutPath);
};
......@@ -59,7 +58,7 @@ class GitoriousCloneWizard : public VcsBase::BaseCheckoutWizard
Q_OBJECT
public:
GitoriousCloneWizard(const QList<QWizardPage *> &parameterPages, QWidget *parent = 0);
GitoriousCloneWizard(const QString &path, QWidget *parent = 0);
};
......
......@@ -48,21 +48,9 @@ CloneWizardFactory::CloneWizardFactory()
setDisplayName(tr("Mercurial Clone"));
}
BaseCheckoutWizard *CloneWizardFactory::create(const QList<QWizardPage *> &parameterPages, QWidget *parent) const
BaseCheckoutWizard *CloneWizardFactory::create(const QString &path, QWidget *parent) const
{
return new CloneWizard(parameterPages, parent);
}
QList<QWizardPage *> CloneWizardFactory::createParameterPages(const QString &path)
{
QList<QWizardPage *> wizardPageList;
const Core::IVersionControl *vc = MercurialPlugin::instance()->versionControl();
if (!vc->isConfigured())
wizardPageList.append(new VcsConfigurationPage(vc));
CloneWizardPage *page = new CloneWizardPage;
page->setPath(path);
wizardPageList.append(page);
return wizardPageList;
return new CloneWizard(path, parent);
}
Command *CloneWizardFactory::createCommand(const QList<QWizardPage *> &parameterPages,
......@@ -95,9 +83,16 @@ Command *CloneWizardFactory::createCommand(const QList<QWizardPage *> &parameter
// CloneWizard:
// --------------------------------------------------------------------
CloneWizard::CloneWizard(const QList<QWizardPage *> &parameterPages, QWidget *parent) :
VcsBase::BaseCheckoutWizard(parameterPages, parent)
CloneWizard::CloneWizard(const QString &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
{
setTitle(tr("Cloning"));
setStartedStatus(tr("Cloning started..."));
const Core::IVersionControl *vc = MercurialPlugin::instance()->versionControl();
if (!vc->isConfigured())
addPage(new VcsConfigurationPage(vc));
CloneWizardPage *page = new CloneWizardPage;
page->setPath(path);
addPage(page);
}
......@@ -45,10 +45,9 @@ class CloneWizardFactory : public VcsBase::BaseCheckoutWizardFactory
public:
CloneWizardFactory();
VcsBase::BaseCheckoutWizard *create(const QList<QWizardPage *> &parameterPages, QWidget *parent = 0) const;
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
protected:
QList<QWizardPage *> createParameterPages(const QString &path);
VcsBase::Command *createCommand(const QList<QWizardPage *> &parameterPages,
QString *checkoutPath);
......@@ -61,7 +60,7 @@ class CloneWizard : public VcsBase::BaseCheckoutWizard
Q_OBJECT
public:
CloneWizard(const QList<QWizardPage *> &parameterPages, QWidget *parent = 0);
CloneWizard(const QString &path, QWidget *parent = 0);
};
} //namespace Internal
......
......@@ -51,16 +51,9 @@ CheckoutWizardFactory::CheckoutWizardFactory()
setDisplayName(tr("Subversion Checkout"));
}
QList<QWizardPage*> CheckoutWizardFactory::createParameterPages(const QString &path)
VcsBase::BaseCheckoutWizard *CheckoutWizardFactory::create(const QString &path, QWidget *parent) const
{
QList<QWizardPage*> rc;
const Core::IVersionControl *vc = SubversionPlugin::instance()->versionControl();
if (!vc->isConfigured())
rc.append(new VcsBase::VcsConfigurationPage(vc));
CheckoutWizardPage *cwp = new CheckoutWizardPage;
cwp->setPath(path);
rc.append(cwp);
return rc;
return new CheckoutWizard(path, parent);
}
VcsBase::Command *CheckoutWizardFactory::createCommand(const QList<QWizardPage*> &parameterPages,
......@@ -95,9 +88,16 @@ VcsBase::Command *CheckoutWizardFactory::createCommand(const QList<QWizardPage*>
// CheckoutWizard:
// --------------------------------------------------------------------
CheckoutWizard::CheckoutWizard(const QList<QWizardPage *> &parameterPages, QWidget *parent) :
VcsBase::BaseCheckoutWizard(parameterPages, parent)
{ }
CheckoutWizard::CheckoutWizard(const QString &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
{
const Core::IVersionControl *vc = SubversionPlugin::instance()->versionControl();
if (!vc->isConfigured())
addPage(new VcsBase::VcsConfigurationPage(vc));
CheckoutWizardPage *cwp = new CheckoutWizardPage;
cwp->setPath(path);
addPage(cwp);
}
} // namespace Internal
} // namespace Subversion
......@@ -43,11 +43,10 @@ class CheckoutWizardFactory : public VcsBase::BaseCheckoutWizardFactory
public:
CheckoutWizardFactory();
VcsBase::BaseCheckoutWizard *create(const QList<QWizardPage *> &parameterPages, QWidget *parent = 0) const;
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
private:
// BaseCheckoutWizard
QList<QWizardPage*> createParameterPages(const QString &path);
VcsBase::Command *createCommand(const QList<QWizardPage*> &parameterPage,
QString *checkoutPath);
};
......@@ -57,7 +56,7 @@ class CheckoutWizard : public VcsBase::BaseCheckoutWizard
Q_OBJECT
public:
CheckoutWizard(const QList<QWizardPage *> &parameterPages, QWidget *parent = 0);
CheckoutWizard(const QString &path, QWidget *parent = 0);
};
} // namespace Internal
......
......@@ -44,16 +44,12 @@
namespace VcsBase {
BaseCheckoutWizard::BaseCheckoutWizard(const QList<QWizardPage *> &parameterPages,
QWidget *parent) :
BaseCheckoutWizard::BaseCheckoutWizard(const QString &path, QWidget *parent) :
Utils::Wizard(parent),
m_progressPage(new Internal::CheckoutProgressWizardPage),
m_progressPageId(-1)
{
foreach (QWizardPage *wp, parameterPages)
addPage(wp);
m_progressPageId = parameterPages.size();
setPage(m_progressPageId, m_progressPage);
Q_UNUSED(path);
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotPageChanged(int)));
connect(m_progressPage, SIGNAL(terminated(bool)), this, SLOT(slotTerminated(bool)));
}
......@@ -88,6 +84,12 @@ void BaseCheckoutWizard::start(Command *command)
m_progressPage->start(command);
}
int BaseCheckoutWizard::exec()
{
m_progressPageId = addPage(m_progressPage);
return Utils::Wizard::exec();
}
void BaseCheckoutWizard::reject()
{
// First click kills, 2nd closes
......
......@@ -45,12 +45,15 @@ class VCSBASE_EXPORT BaseCheckoutWizard : public Utils::Wizard
Q_OBJECT
public:
explicit BaseCheckoutWizard(const QList<QWizardPage *> &parameterPages, QWidget *parent = 0);
explicit BaseCheckoutWizard(const QString &path, QWidget *parent = 0);
void setTitle(const QString &title);
void setStartedStatus(const QString &title);
void start(VcsBase::Command *command);
public slots:
int exec();
signals:
void progressPageShown();
......
......@@ -71,13 +71,11 @@ public:
void clear();
BaseCheckoutWizard *wizard;
QList<QWizardPage *> parameterPages;
QString checkoutPath;
};
void BaseCheckoutWizardFactoryPrivate::clear()
{
parameterPages.clear();
delete wizard;
wizard = 0;
checkoutPath.clear();
......@@ -108,8 +106,7 @@ void BaseCheckoutWizardFactory::runWizard(const QString &path, QWidget *parent,
QTC_ASSERT(!d->wizard, return);
// Create dialog and launch
d->parameterPages = createParameterPages(path);
d->wizard = create(d->parameterPages, parent);
d->wizard = create(path, parent);
connect(d->wizard, SIGNAL(progressPageShown()), this, SLOT(slotProgressPageShown()));
d->wizard->setWindowTitle(displayName());
if (d->wizard->exec() != QDialog::Accepted) {
......@@ -180,7 +177,10 @@ QString BaseCheckoutWizardFactory::openProject(const QString &path, QString *err
void BaseCheckoutWizardFactory::slotProgressPageShown()
{
Command *command = createCommand(d->parameterPages, &(d->checkoutPath));
QList<QWizardPage *> pages;
foreach (int id, d->wizard->pageIds())
pages << d->wizard->page(id);
Command *command = createCommand(pages, &(d->checkoutPath));
d->wizard->start(command);
}
......
......@@ -58,10 +58,9 @@ public:
static QString openProject(const QString &path, QString *errorMessage);
virtual BaseCheckoutWizard *create(const QList<QWizardPage *> &parameterPages, QWidget *parent = 0) const = 0;
virtual BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const = 0;
protected:
virtual QList<QWizardPage *> createParameterPages(const QString &path) = 0;
virtual Command *createCommand(const QList<QWizardPage *> &parameterPages,
QString *checkoutPath) = 0;
......
Markdown is supported
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