Vcs: Make checkout wizards work, even when VCS in unconfigured

They used to grab the first page in the set of pages and that
is the VCS setup page if the VCS was not configured before the
wizard was started. Then the wizards just stopped.

Change-Id: I8ea5bc373c07fb5c68a4814396864de6b8413747
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Tobias Hunger
2014-05-05 16:48:02 +02:00
parent 6644a08c21
commit dae8df0567
6 changed files with 26 additions and 7 deletions

View File

@@ -71,7 +71,11 @@ QList<QWizardPage *> CloneWizardFactory::createParameterPages(const QString &pat
VcsBase::Command *CloneWizardFactory::createCommand(const QList<QWizardPage *> &parameterPages,
QString *checkoutPath)
{
const CloneWizardPage *page = qobject_cast<const CloneWizardPage *>(parameterPages.front());
const CloneWizardPage *page = 0;
foreach (QWizardPage *p, parameterPages) {
if ((page = qobject_cast<const CloneWizardPage *>(p)))
break;
}
if (!page)
return 0;

View File

@@ -70,7 +70,11 @@ VcsBase::Command *CheckoutWizardFactory::createCommand(const QList<QWizardPage*>
{
// Collect parameters for the checkout command.
// CVS does not allow for checking out into a different directory.
const CheckoutWizardPage *cwp = qobject_cast<const CheckoutWizardPage *>(parameterPages.front());
const CheckoutWizardPage *cwp = 0;
foreach (QWizardPage *p, parameterPages) {
if ((cwp = qobject_cast<const CheckoutWizardPage *>(p)))
break;
}
QTC_ASSERT(cwp, return 0);
const CvsSettings settings = CvsPlugin::instance()->settings();
const QString binary = settings.binaryPath();

View File

@@ -71,8 +71,7 @@ VcsBase::Command *CloneWizardFactory::createCommand(const QList<QWizardPage*> &p
// Collect parameters for the clone command.
const CloneWizardPage *cwp = 0;
foreach (QWizardPage *wp, parameterPages) {
cwp = qobject_cast<const CloneWizardPage *>(wp);
if (cwp)
if ((cwp = qobject_cast<const CloneWizardPage *>(wp)))
break;
}

View File

@@ -102,7 +102,11 @@ QList<QWizardPage*> GitoriousCloneWizardFactory::createParameterPages(const QStr
VcsBase::Command *GitoriousCloneWizardFactory::createCommand(const QList<QWizardPage*> &parameterPages,
QString *checkoutPath)
{
const Git::CloneWizardPage *cwp = qobject_cast<const Git::CloneWizardPage *>(parameterPages.back());
const Git::CloneWizardPage *cwp = 0;
foreach (QWizardPage *p, parameterPages) {
if ((cwp = qobject_cast<const Git::CloneWizardPage *>(p)))
break;
}
QTC_ASSERT(cwp, return 0);
return cwp->createCheckoutJob(checkoutPath);
}

View File

@@ -68,7 +68,11 @@ QList<QWizardPage *> CloneWizardFactory::createParameterPages(const QString &pat
Command *CloneWizardFactory::createCommand(const QList<QWizardPage *> &parameterPages,
QString *checkoutPath)
{
const CloneWizardPage *page = qobject_cast<const CloneWizardPage *>(parameterPages.front());
const CloneWizardPage *page = 0;
foreach (QWizardPage *p, parameterPages) {
if ((page = qobject_cast<const CloneWizardPage *>(p)))
break;
}
if (!page)
return 0;

View File

@@ -67,7 +67,11 @@ VcsBase::Command *CheckoutWizardFactory::createCommand(const QList<QWizardPage*>
QString *checkoutPath)
{
// Collect parameters for the checkout command.
const CheckoutWizardPage *cwp = qobject_cast<const CheckoutWizardPage *>(parameterPages.front());
const CheckoutWizardPage *cwp = 0;
foreach (const QWizardPage *p, parameterPages) {
if ((cwp = qobject_cast<const CheckoutWizardPage *>(p)))
break;
}
QTC_ASSERT(cwp, return 0);
const SubversionSettings settings = SubversionPlugin::instance()->settings();
const QString binary = settings.binaryPath();