Commit cceb0adb authored by Tobias Hunger's avatar Tobias Hunger

VCS: Use the configuration page in all the checkout wizards

Task-number: QTCREATORBUG-3752
parent b520f184
......@@ -37,8 +37,10 @@
#include "bazaarclient.h"
#include "bazaarsettings.h"
#include <coreplugin/iversioncontrol.h>
#include <vcsbase/checkoutjobs.h>
#include <vcsbase/vcsbaseconstants.h>
#include <vcsbase/vcsconfigurationpage.h>
#include <QtCore/QDebug>
......@@ -69,6 +71,9 @@ QString CloneWizard::displayName() const
QList<QWizardPage*> CloneWizard::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);
......
......@@ -34,8 +34,10 @@
#include "checkoutwizardpage.h"
#include "cvsplugin.h"
#include <coreplugin/iversioncontrol.h>
#include <vcsbase/checkoutjobs.h>
#include <vcsbase/vcsbaseconstants.h>
#include <vcsbase/vcsconfigurationpage.h>
#include <utils/qtcassert.h>
#include <QtGui/QIcon>
......@@ -66,9 +68,12 @@ QString CheckoutWizard::displayName() const
QList<QWizardPage*> CheckoutWizard::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);
QList<QWizardPage*> rc;
rc.push_back(cwp);
return rc;
}
......@@ -80,7 +85,7 @@ QSharedPointer<VCSBase::AbstractCheckoutJob> CheckoutWizard::createJob(const QLi
// CVS does not allow for checking out into a different directory.
const CheckoutWizardPage *cwp = qobject_cast<const CheckoutWizardPage *>(parameterPages.front());
QTC_ASSERT(cwp, return QSharedPointer<VCSBase::AbstractCheckoutJob>())
const CVSSettings settings = CVSPlugin::cvsPluginInstance()->settings();
const CVSSettings settings = CVSPlugin::instance()->settings();
const QString binary = settings.cvsCommand;
QStringList args;
const QString repository = cwp->repository();
......
......@@ -1321,7 +1321,7 @@ void CVSPlugin::setSettings(const CVSSettings &s)
}
}
CVSPlugin *CVSPlugin::cvsPluginInstance()
CVSPlugin *CVSPlugin::instance()
{
QTC_ASSERT(m_cvsPluginInstance, return m_cvsPluginInstance);
return m_cvsPluginInstance;
......
......@@ -102,7 +102,7 @@ public:
// cvs 'edit' is used to implement 'open' (cvsnt).
bool edit(const QString &topLevel, const QStringList &files);
static CVSPlugin *cvsPluginInstance();
static CVSPlugin *instance();
public slots:
void vcsAnnotate(const QString &file, const QString &revision /* = QString() */, int lineNumber);
......
......@@ -111,7 +111,7 @@ QString SettingsPage::displayName() const
QWidget *SettingsPage::createPage(QWidget *parent)
{
m_widget = new SettingsPageWidget(parent);
m_widget->setSettings(CVSPlugin::cvsPluginInstance()->settings());
m_widget->setSettings(CVSPlugin::instance()->settings());
if (m_searchKeywords.isEmpty())
m_searchKeywords = m_widget->searchKeywords();
return m_widget;
......@@ -119,7 +119,7 @@ QWidget *SettingsPage::createPage(QWidget *parent)
void SettingsPage::apply()
{
CVSPlugin::cvsPluginInstance()->setSettings(m_widget->settings());
CVSPlugin::instance()->setSettings(m_widget->settings());
}
bool SettingsPage::matches(const QString &s) const
......
......@@ -33,8 +33,12 @@
#include "clonewizard.h"
#include "clonewizardpage.h"
#include "gitplugin.h"
#include "gitversioncontrol.h"
#include <vcsbase/checkoutjobs.h>
#include <vcsbase/vcsbaseconstants.h>
#include <vcsbase/vcsconfigurationpage.h>
#include <utils/qtcassert.h>
#include <QtGui/QIcon>
......@@ -65,9 +69,12 @@ QString CloneWizard::displayName() const
QList<QWizardPage*> CloneWizard::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);
QList<QWizardPage*> rc;
rc.push_back(cwp);
return rc;
}
......
......@@ -36,8 +36,12 @@
#include "gitoriousrepositorywizardpage.h"
#include "clonewizardpage.h"
#include <git/gitplugin.h>
#include <coreplugin/iversioncontrol.h>
#include <vcsbase/checkoutjobs.h>
#include <vcsbase/vcsbaseconstants.h>
#include <vcsbase/vcsconfigurationpage.h>
#include <utils/qtcassert.h>
#include <QtCore/QUrl>
......@@ -93,13 +97,17 @@ QString GitoriousCloneWizard::displayName() const
QList<QWizardPage*> GitoriousCloneWizard::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);
QList<QWizardPage*> rc;
rc << hostPage << projectPage << repoPage << clonePage;
return rc;
}
......
......@@ -35,10 +35,10 @@
#include "mercurialplugin.h"
#include "mercurialsettings.h"
#include <coreplugin/iversioncontrol.h>
#include <vcsbase/checkoutjobs.h>
#include <vcsbase/vcsbaseconstants.h>
#include <QtCore/QDebug>
#include <vcsbase/vcsconfigurationpage.h>
using namespace Mercurial::Internal;
......@@ -67,9 +67,12 @@ QString CloneWizard::displayName() const
QList<QWizardPage*> CloneWizard::createParameterPages(const QString &path)
{
QList<QWizardPage*> wizardPageList;
const Core::IVersionControl *vc = MercurialPlugin::instance()->versionControl();
if (!vc->isConfigured())
wizardPageList.append(new VCSBase::VcsConfigurationPage(vc));
CloneWizardPage *page = new CloneWizardPage;
page->setPath(path);
wizardPageList.push_back(page);
wizardPageList.append(page);
return wizardPageList;
}
......
......@@ -34,8 +34,10 @@
#include "checkoutwizardpage.h"
#include "subversionplugin.h"
#include <coreplugin/iversioncontrol.h>
#include <vcsbase/checkoutjobs.h>
#include <vcsbase/vcsbaseconstants.h>
#include <vcsbase/vcsconfigurationpage.h>
#include <utils/qtcassert.h>
#include <QtGui/QIcon>
......@@ -66,10 +68,13 @@ QString CheckoutWizard::displayName() const
QList<QWizardPage*> CheckoutWizard::createParameterPages(const QString &path)
{
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);
QList<QWizardPage*> rc;
rc.push_back(cwp);
rc.append(cwp);
return rc;
}
......@@ -79,7 +84,7 @@ QSharedPointer<VCSBase::AbstractCheckoutJob> CheckoutWizard::createJob(const QLi
// Collect parameters for the checkout command.
const CheckoutWizardPage *cwp = qobject_cast<const CheckoutWizardPage *>(parameterPages.front());
QTC_ASSERT(cwp, return QSharedPointer<VCSBase::AbstractCheckoutJob>())
const SubversionSettings settings = SubversionPlugin::subversionPluginInstance()->settings();
const SubversionSettings settings = SubversionPlugin::instance()->settings();
const QString binary = settings.svnCommand;
const QString directory = cwp->directory();
QStringList args;
......
......@@ -120,7 +120,7 @@ QString SettingsPage::displayName() const
QWidget *SettingsPage::createPage(QWidget *parent)
{
m_widget = new SettingsPageWidget(parent);
m_widget->setSettings(SubversionPlugin::subversionPluginInstance()->settings());
m_widget->setSettings(SubversionPlugin::instance()->settings());
if (m_searchKeywords.isEmpty())
m_searchKeywords = m_widget->searchKeywords();
return m_widget;
......@@ -128,7 +128,7 @@ QWidget *SettingsPage::createPage(QWidget *parent)
void SettingsPage::apply()
{
SubversionPlugin::subversionPluginInstance()->setSettings(m_widget->settings());
SubversionPlugin::instance()->setSettings(m_widget->settings());
}
bool SettingsPage::matches(const QString &s) const
......
......@@ -134,7 +134,7 @@ QString SubversionEditor::fileNameFromDiffSpecification(const QTextBlock &inBloc
const int tabIndex = diffFileName.lastIndexOf(QLatin1Char('\t'));
if (tabIndex != -1)
diffFileName.truncate(tabIndex);
const QString rc = findDiffFile(diffFileName, SubversionPlugin::subversionPluginInstance()->versionControl());
const QString rc = findDiffFile(diffFileName, SubversionPlugin::instance()->versionControl());
if (Subversion::Constants::debug)
qDebug() << Q_FUNC_INFO << diffFileName << rc << source();
return rc;
......
......@@ -1205,7 +1205,7 @@ void SubversionPlugin::setSettings(const SubversionSettings &s)
}
}
SubversionPlugin *SubversionPlugin::subversionPluginInstance()
SubversionPlugin *SubversionPlugin::instance()
{
QTC_ASSERT(m_subversionPluginInstance, return m_subversionPluginInstance);
return m_subversionPluginInstance;
......
......@@ -103,7 +103,7 @@ public:
virtual bool vcsCheckout(const QString &directory, const QByteArray &url);
virtual QString vcsGetRepositoryURL(const QString &directory);
static SubversionPlugin *subversionPluginInstance();
static SubversionPlugin *instance();
// Add authorization options to the command line arguments.
static QStringList addAuthenticationOptions(const QStringList &args,
......
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