2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-07-17 17:19:23 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
|
|
|
|
** Contact: http://www.qt-project.org/legal
|
2009-07-17 17:19:23 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-07-17 17:19:23 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2009-07-17 17:19:23 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-07-17 17:19:23 +02:00
|
|
|
|
|
|
|
|
#include "checkoutwizard.h"
|
|
|
|
|
#include "checkoutwizardpage.h"
|
|
|
|
|
#include "subversionplugin.h"
|
|
|
|
|
|
2011-04-20 15:49:06 +02:00
|
|
|
#include <coreplugin/iversioncontrol.h>
|
2009-07-17 17:19:23 +02:00
|
|
|
#include <vcsbase/checkoutjobs.h>
|
2009-11-27 10:33:24 +01:00
|
|
|
#include <vcsbase/vcsbaseconstants.h>
|
2011-04-20 15:49:06 +02:00
|
|
|
#include <vcsbase/vcsconfigurationpage.h>
|
2009-07-17 17:19:23 +02:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QIcon>
|
2009-07-17 17:19:23 +02:00
|
|
|
|
|
|
|
|
namespace Subversion {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
CheckoutWizard::CheckoutWizard(QObject *parent) :
|
2012-01-07 12:31:48 +01:00
|
|
|
VcsBase::BaseCheckoutWizard(parent)
|
2009-07-17 17:19:23 +02:00
|
|
|
{
|
2012-01-07 12:31:48 +01:00
|
|
|
setId(QLatin1String(VcsBase::Constants::VCS_ID_SUBVERSION));
|
2009-07-17 17:19:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QIcon CheckoutWizard::icon() const
|
|
|
|
|
{
|
2010-05-19 15:38:17 +02:00
|
|
|
return QIcon(QLatin1String(":/subversion/images/subversion.png"));
|
2009-07-17 17:19:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString CheckoutWizard::description() const
|
|
|
|
|
{
|
2010-05-17 13:01:45 +02:00
|
|
|
return tr("Checks out a Subversion repository and tries to load the contained project.");
|
2009-07-17 17:19:23 +02:00
|
|
|
}
|
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
QString CheckoutWizard::displayName() const
|
2009-07-17 17:19:23 +02:00
|
|
|
{
|
|
|
|
|
return tr("Subversion Checkout");
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-21 11:14:48 +02:00
|
|
|
QList<QWizardPage*> CheckoutWizard::createParameterPages(const QString &path)
|
2009-07-17 17:19:23 +02:00
|
|
|
{
|
2011-04-20 15:49:06 +02:00
|
|
|
QList<QWizardPage*> rc;
|
|
|
|
|
const Core::IVersionControl *vc = SubversionPlugin::instance()->versionControl();
|
|
|
|
|
if (!vc->isConfigured())
|
2012-01-07 12:31:48 +01:00
|
|
|
rc.append(new VcsBase::VcsConfigurationPage(vc));
|
2009-07-17 17:19:23 +02:00
|
|
|
CheckoutWizardPage *cwp = new CheckoutWizardPage;
|
|
|
|
|
cwp->setPath(path);
|
2011-04-20 15:49:06 +02:00
|
|
|
rc.append(cwp);
|
2009-07-21 11:14:48 +02:00
|
|
|
return rc;
|
2009-07-17 17:19:23 +02:00
|
|
|
}
|
|
|
|
|
|
2012-01-07 12:31:48 +01:00
|
|
|
QSharedPointer<VcsBase::AbstractCheckoutJob> CheckoutWizard::createJob(const QList<QWizardPage*> ¶meterPages,
|
2009-07-17 17:19:23 +02:00
|
|
|
QString *checkoutPath)
|
|
|
|
|
{
|
|
|
|
|
// Collect parameters for the checkout command.
|
2009-07-21 11:14:48 +02:00
|
|
|
const CheckoutWizardPage *cwp = qobject_cast<const CheckoutWizardPage *>(parameterPages.front());
|
2012-04-17 08:01:25 +02:00
|
|
|
QTC_ASSERT(cwp, return QSharedPointer<VcsBase::AbstractCheckoutJob>());
|
2011-04-20 15:49:06 +02:00
|
|
|
const SubversionSettings settings = SubversionPlugin::instance()->settings();
|
2012-08-21 14:45:42 +03:00
|
|
|
const QString binary = settings.svnBinaryPath;
|
2009-07-17 17:19:23 +02:00
|
|
|
const QString directory = cwp->directory();
|
|
|
|
|
QStringList args;
|
|
|
|
|
args << QLatin1String("checkout") << cwp->repository() << directory;
|
|
|
|
|
const QString workingDirectory = cwp->path();
|
|
|
|
|
*checkoutPath = workingDirectory + QLatin1Char('/') + directory;
|
2010-06-08 10:04:23 +02:00
|
|
|
const QStringList completeArgs = settings.hasAuthentication() ?
|
|
|
|
|
SubversionPlugin::addAuthenticationOptions(args, settings.user, settings.password) :
|
|
|
|
|
args;
|
2012-01-07 12:31:48 +01:00
|
|
|
VcsBase::ProcessCheckoutJob *job = new VcsBase::ProcessCheckoutJob;
|
2010-08-12 14:44:57 +02:00
|
|
|
job->addStep(binary, completeArgs, workingDirectory);
|
2012-01-07 12:31:48 +01:00
|
|
|
return QSharedPointer<VcsBase::AbstractCheckoutJob>(job);
|
2009-07-17 17:19:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Subversion
|