1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2009 Brian McGillion
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #include "clonewizard.h"
34 #include "clonewizardpage.h"
35 #include "mercurialplugin.h"
36 #include "mercurialsettings.h"
38 #include <vcsbase/checkoutjobs.h>
39 #include <vcsbase/vcsbaseconstants.h>
41 #include <QtCore/QDebug>
43 using namespace Mercurial::Internal;
45 CloneWizard::CloneWizard(QObject *parent)
46 : VCSBase::BaseCheckoutWizard(parent),
47 m_icon(QIcon(QLatin1String(":/mercurial/images/hg.png")))
49 setId(QLatin1String(VCSBase::Constants::VCS_ID_MERCURIAL));
52 QIcon CloneWizard::icon() const
57 QString CloneWizard::description() const
59 return tr("Clones a Mercurial repository and tries to load the contained project.");
62 QString CloneWizard::displayName() const
64 return tr("Mercurial Clone");
67 QList<QWizardPage*> CloneWizard::createParameterPages(const QString &path)
69 QList<QWizardPage*> wizardPageList;
70 CloneWizardPage *page = new CloneWizardPage;
72 wizardPageList.push_back(page);
73 return wizardPageList;
76 QSharedPointer<VCSBase::AbstractCheckoutJob> CloneWizard::createJob(const QList<QWizardPage *> ¶meterPages,
77 QString *checkoutPath)
79 const CloneWizardPage *page = qobject_cast<const CloneWizardPage *>(parameterPages.front());
82 return QSharedPointer<VCSBase::AbstractCheckoutJob>();
84 const MercurialSettings &settings = MercurialPlugin::instance()->settings();
86 QStringList args = settings.standardArguments();
87 QString path = page->path();
88 QString directory = page->directory();
90 args << QLatin1String("clone") << page->repository() << directory;
91 *checkoutPath = path + QLatin1Char('/') + directory;
92 VCSBase::ProcessCheckoutJob *job = new VCSBase::ProcessCheckoutJob;
93 job->addStep(settings.binary(), args, path);
94 return QSharedPointer<VCSBase::AbstractCheckoutJob>(job);