summaryrefslogtreecommitdiff
path: root/src/plugins/bazaar
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@digia.com>2014-05-05 17:56:54 +0200
committerTobias Hunger <tobias.hunger@digia.com>2014-05-26 11:44:43 +0200
commit8e126df5459f2eea2a1736bd804d6f670bc18ba7 (patch)
tree6157d9605c7738e253193250e93fe45b0732f86d /src/plugins/bazaar
parent719d39d372b2962147e97cdb243b9fb47d8d1fa8 (diff)
downloadqt-creator-8e126df5459f2eea2a1736bd804d6f670bc18ba7.tar.gz
BaseCheckoutWizard*: Move createCommand from factory into Wizard
Change-Id: I0dcc931f279b59f0d6cf7afb553a2fed30baae7a Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/bazaar')
-rw-r--r--src/plugins/bazaar/bazaarclient.h2
-rw-r--r--src/plugins/bazaar/clonewizard.cpp55
-rw-r--r--src/plugins/bazaar/clonewizard.h7
3 files changed, 31 insertions, 33 deletions
diff --git a/src/plugins/bazaar/bazaarclient.h b/src/plugins/bazaar/bazaarclient.h
index 06e717b4f4..8896d933fa 100644
--- a/src/plugins/bazaar/bazaarclient.h
+++ b/src/plugins/bazaar/bazaarclient.h
@@ -76,7 +76,7 @@ protected:
StatusItem parseStatusLine(const QString &line) const;
private:
- friend class CloneWizardFactory;
+ friend class CloneWizard;
};
} // namespace Internal
diff --git a/src/plugins/bazaar/clonewizard.cpp b/src/plugins/bazaar/clonewizard.cpp
index d6226e0096..ec89f684eb 100644
--- a/src/plugins/bazaar/clonewizard.cpp
+++ b/src/plugins/bazaar/clonewizard.cpp
@@ -56,22 +56,39 @@ VcsBase::BaseCheckoutWizard *CloneWizardFactory::create(const QString &path, QWi
return new CloneWizard(path, parent);
}
-VcsBase::Command *CloneWizardFactory::createCommand(const QList<QWizardPage *> &parameterPages,
- QString *checkoutPath)
+// --------------------------------------------------------------------
+// CloneWizard:
+// --------------------------------------------------------------------
+
+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);
+}
+
+VcsBase::Command *CloneWizard::createCommand(QString *checkoutDir)
{
- const CloneWizardPage *page = 0;
- foreach (QWizardPage *p, parameterPages) {
- if ((page = qobject_cast<const CloneWizardPage *>(p)))
+ const CloneWizardPage *cwp = 0;
+ foreach (int pageId, pageIds()) {
+ if ((cwp = qobject_cast<const CloneWizardPage *>(page(pageId))))
break;
}
- if (!page)
+ if (!cwp)
return 0;
const BazaarSettings &settings = BazaarPlugin::instance()->settings();
- *checkoutPath = page->path() + QLatin1Char('/') + page->directory();
+ *checkoutDir = cwp->path() + QLatin1Char('/') + cwp->directory();
- const CloneOptionsPanel *panel = page->cloneOptionsPanel();
+ const CloneOptionsPanel *panel = cwp->cloneOptionsPanel();
QStringList extraOptions;
if (panel->isUseExistingDirectoryOptionEnabled())
extraOptions += QLatin1String("--use-existing-dir");
@@ -92,28 +109,10 @@ VcsBase::Command *CloneWizardFactory::createCommand(const QList<QWizardPage *> &
const BazaarClient *client = BazaarPlugin::instance()->client();
QStringList args;
args << client->vcsCommandString(BazaarClient::CloneCommand)
- << extraOptions << page->repository() << page->directory();
+ << extraOptions << cwp->repository() << cwp->directory();
- VcsBase::Command *command = new VcsBase::Command(settings.binaryPath(), page->path(),
+ VcsBase::Command *command = new VcsBase::Command(settings.binaryPath(), cwp->path(),
client->processEnvironment());
command->addJob(args, -1);
return command;
}
-
-// --------------------------------------------------------------------
-// CloneWizard:
-// --------------------------------------------------------------------
-
-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);
-}
diff --git a/src/plugins/bazaar/clonewizard.h b/src/plugins/bazaar/clonewizard.h
index e374646863..b0bf361693 100644
--- a/src/plugins/bazaar/clonewizard.h
+++ b/src/plugins/bazaar/clonewizard.h
@@ -46,10 +46,6 @@ public:
CloneWizardFactory();
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
-
-private:
- VcsBase::Command *createCommand(const QList<QWizardPage *> &parameterPages,
- QString *checkoutPath);
};
class CloneWizard : public VcsBase::BaseCheckoutWizard
@@ -58,6 +54,9 @@ class CloneWizard : public VcsBase::BaseCheckoutWizard
public:
CloneWizard(const QString &path, QWidget *parent = 0);
+
+protected:
+ VcsBase::Command *createCommand(QString *checkoutDir);
};
} // namespace Internal