Commit caca9dfa authored by Tobias Hunger's avatar Tobias Hunger
Browse files

CheckoutWizards: Simplify code to look up specific pages



Change-Id: I0098e17585d73e05632027676e7712ef9c843da2
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 75f06755
......@@ -40,6 +40,8 @@
#include <vcsbase/vcsbaseconstants.h>
#include <vcsbase/wizard/vcsconfigurationpage.h>
#include <utils/qtcassert.h>
#include <QDebug>
using namespace VcsBase;
......@@ -70,14 +72,8 @@ CloneWizard::CloneWizard(const Utils::FileName &path, QWidget *parent) :
VcsCommand *CloneWizard::createCommand(Utils::FileName *checkoutDir)
{
const CloneWizardPage *cwp = 0;
foreach (int pageId, pageIds()) {
if ((cwp = qobject_cast<const CloneWizardPage *>(page(pageId))))
break;
}
if (!cwp)
return 0;
const CloneWizardPage *cwp = find<CloneWizardPage>();
QTC_ASSERT(cwp, return 0);
const VcsBaseClientSettings &settings = BazaarPlugin::instance()->client()->settings();
*checkoutDir = Utils::FileName::fromString(cwp->path() + QLatin1Char('/') + cwp->directory());
......
......@@ -66,13 +66,9 @@ VcsCommand *CheckoutWizard::createCommand(Utils::FileName *checkoutDir)
{
// Collect parameters for the checkout command.
// CVS does not allow for checking out into a different directory.
const CheckoutWizardPage *cwp = 0;
foreach (int pageId, pageIds()) {
if ((cwp = qobject_cast<const CheckoutWizardPage *>(page(pageId))))
break;
}
const CheckoutWizardPage *cwp = find<CheckoutWizardPage>();
QTC_ASSERT(cwp, return 0);
const CvsSettings settings = CvsPlugin::instance()->client()->settings();
const Utils::FileName binary = settings.binaryPath();
QStringList args;
......
......@@ -67,12 +67,7 @@ CloneWizard::CloneWizard(const Utils::FileName &path, QWidget *parent) :
VcsCommand *CloneWizard::createCommand(Utils::FileName *checkoutDir)
{
// Collect parameters for the clone command.
const CloneWizardPage *cwp = 0;
foreach (int pageId, pageIds()) {
if ((cwp = qobject_cast<const CloneWizardPage *>(page(pageId))))
break;
}
const CloneWizardPage *cwp = find<CloneWizardPage>();
QTC_ASSERT(cwp, return 0);
return cwp->createCheckoutJob(checkoutDir);
}
......
......@@ -39,6 +39,8 @@
#include <vcsbase/vcsbaseconstants.h>
#include <vcsbase/wizard/vcsconfigurationpage.h>
#include <utils/qtcassert.h>
using namespace VcsBase;
namespace Mercurial {
......@@ -66,14 +68,8 @@ CloneWizard::CloneWizard(const Utils::FileName &path, QWidget *parent) :
VcsCommand *CloneWizard::createCommand(Utils::FileName *checkoutDir)
{
const CloneWizardPage *cwp = 0;
foreach (int pageId, pageIds()) {
if ((cwp = qobject_cast<const CloneWizardPage *>(page(pageId))))
break;
}
if (!cwp)
return 0;
const CloneWizardPage *cwp = find<CloneWizardPage>();
QTC_ASSERT(cwp, return 0);
const VcsBaseClientSettings &settings = MercurialPlugin::client()->settings();
......
......@@ -67,11 +67,7 @@ CheckoutWizard::CheckoutWizard(const FileName &path, QWidget *parent) :
VcsCommand *CheckoutWizard::createCommand(FileName *checkoutDir)
{
// Collect parameters for the checkout command.
const CheckoutWizardPage *cwp = 0;
foreach (int pageId, pageIds()) {
if ((cwp = qobject_cast<const CheckoutWizardPage *>(page(pageId))))
break;
}
const CheckoutWizardPage *cwp = find<CheckoutWizardPage>();
QTC_ASSERT(cwp, return 0);
SubversionClient *client = SubversionPlugin::instance()->client();
......
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