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