1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2009 Brian McGillion
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #include "clonewizard.h"
35 #include "clonewizardpage.h"
36 #include "mercurialplugin.h"
37 #include "mercurialsettings.h"
39 #include <vcsbase/checkoutjobs.h>
40 #include <vcsbase/vcsbaseconstants.h>
42 #include <QtCore/QDebug>
44 using namespace Mercurial::Internal;
46 CloneWizard::CloneWizard(QObject *parent)
47 : VCSBase::BaseCheckoutWizard(parent),
48 m_icon(QIcon(QLatin1String(":/mercurial/images/hg.png")))
50 setId(QLatin1String(VCSBase::Constants::VCS_ID_MERCURIAL));
53 QIcon CloneWizard::icon() const
58 QString CloneWizard::description() const
60 return tr("Clones a Mercurial repository and tries to load the contained project.");
63 QString CloneWizard::displayName() const
65 return tr("Mercurial Clone");
68 QList<QWizardPage*> CloneWizard::createParameterPages(const QString &path)
70 QList<QWizardPage*> wizardPageList;
71 CloneWizardPage *page = new CloneWizardPage;
73 wizardPageList.push_back(page);
74 return wizardPageList;
77 QSharedPointer<VCSBase::AbstractCheckoutJob> CloneWizard::createJob(const QList<QWizardPage *> ¶meterPages,
78 QString *checkoutPath)
80 const CloneWizardPage *page = qobject_cast<const CloneWizardPage *>(parameterPages.front());
83 return QSharedPointer<VCSBase::AbstractCheckoutJob>();
85 const MercurialSettings &settings = MercurialPlugin::instance()->settings();
87 QStringList args = settings.standardArguments();
88 QString path = page->path();
89 QString directory = page->directory();
91 args << QLatin1String("clone") << page->repository() << directory;
92 *checkoutPath = path + QLatin1Char('/') + directory;
93 VCSBase::ProcessCheckoutJob *job = new VCSBase::ProcessCheckoutJob;
94 job->addStep(settings.binary(), args, path);
95 return QSharedPointer<VCSBase::AbstractCheckoutJob>(job);