forked from qt-creator/qt-creator
Mercurial: Replace CloneWizard with a Json wizard
Change-Id: Idcf5c523010ecb46d0ec6fa9475d182d14984852 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -1,77 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 Brian McGillion
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** 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 The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "clonewizard.h"
|
||||
#include "clonewizardpage.h"
|
||||
#include "mercurialclient.h"
|
||||
#include "mercurialplugin.h"
|
||||
#include "mercurialsettings.h"
|
||||
|
||||
#include <coreplugin/iversioncontrol.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <vcsbase/wizard/vcsconfigurationpage.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace VcsBase;
|
||||
|
||||
namespace Mercurial {
|
||||
namespace Internal {
|
||||
// --------------------------------------------------------------------
|
||||
// CloneWizard:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
CloneWizard::CloneWizard(const Utils::FileName &path, QWidget *parent) :
|
||||
BaseCheckoutWizard(Constants::VCS_ID_MERCURIAL, parent)
|
||||
{
|
||||
setTitle(tr("Cloning"));
|
||||
setStartedStatus(tr("Cloning started..."));
|
||||
|
||||
auto page = new CloneWizardPage;
|
||||
page->setPath(path.toString());
|
||||
addPage(page);
|
||||
}
|
||||
|
||||
VcsCommand *CloneWizard::createCommand(Utils::FileName *checkoutDir)
|
||||
{
|
||||
const CloneWizardPage *cwp = find<CloneWizardPage>();
|
||||
QTC_ASSERT(cwp, return 0);
|
||||
|
||||
const Utils::FileName path = Utils::FileName::fromString(cwp->path());
|
||||
const QString directory = cwp->directory();
|
||||
|
||||
*checkoutDir = Utils::FileName::fromString(path.toString() + QLatin1Char('/') + directory);
|
||||
|
||||
return createCommandImpl(cwp->repository(), path, directory, QStringList());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Mercurial
|
||||
@@ -1,54 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 Brian McGillion
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** 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 The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CLONEWIZARD_H
|
||||
#define CLONEWIZARD_H
|
||||
|
||||
#include <vcsbase/basecheckoutwizardfactory.h>
|
||||
#include <vcsbase/basecheckoutwizard.h>
|
||||
|
||||
namespace Mercurial {
|
||||
namespace Internal {
|
||||
|
||||
class CloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CloneWizard(const Utils::FileName &path, QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
VcsBase::VcsCommand *createCommand(Utils::FileName *checkoutDir);
|
||||
};
|
||||
|
||||
} //namespace Internal
|
||||
} //namespace Mercurial
|
||||
|
||||
#endif // CLONEWIZARD_H
|
||||
@@ -1,59 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 Brian McGillion
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** 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 The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "clonewizardpage.h"
|
||||
|
||||
namespace Mercurial {
|
||||
namespace Internal {
|
||||
|
||||
CloneWizardPage::CloneWizardPage(QWidget *parent)
|
||||
: VcsBase::BaseCheckoutWizardPage(parent)
|
||||
{
|
||||
setTitle(tr("Location"));
|
||||
setSubTitle(tr("Specify repository URL, checkout directory and path."));
|
||||
setRepositoryLabel(tr("Clone URL:"));
|
||||
setBranchSelectorVisible(false);
|
||||
}
|
||||
|
||||
QString CloneWizardPage::directoryFromRepository(const QString &repository) const
|
||||
{
|
||||
// Mercurial repositories are generally of the form protocol://repositoryUrl/repository/
|
||||
// We are just looking for repository.
|
||||
const QChar slash = QLatin1Char('/');
|
||||
QString repo = repository.trimmed();
|
||||
if (repo.endsWith(slash))
|
||||
repo.truncate(repo.size() - 1);
|
||||
|
||||
// Take the basename or the repository url.
|
||||
return repo.mid(repo.lastIndexOf(slash) + 1);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Mercurial
|
||||
@@ -1,52 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 Brian McGillion
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** 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 The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CLONEWIZARDPAGE_H
|
||||
#define CLONEWIZARDPAGE_H
|
||||
|
||||
#include <vcsbase/basecheckoutwizardpage.h>
|
||||
|
||||
namespace Mercurial {
|
||||
namespace Internal {
|
||||
|
||||
class CloneWizardPage : public VcsBase::BaseCheckoutWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CloneWizardPage(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
QString directoryFromRepository(const QString &rrepository) const;
|
||||
};
|
||||
|
||||
} //namespace Internal
|
||||
} //namespace Mercurial
|
||||
|
||||
#endif // CLONEWIZARDPAGE_H
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -9,8 +9,6 @@ SOURCES += mercurialplugin.cpp \
|
||||
srcdestdialog.cpp \
|
||||
mercurialcommitwidget.cpp \
|
||||
commiteditor.cpp \
|
||||
clonewizardpage.cpp \
|
||||
clonewizard.cpp \
|
||||
mercurialsettings.cpp \
|
||||
authenticationdialog.cpp
|
||||
HEADERS += mercurialplugin.h \
|
||||
@@ -24,8 +22,6 @@ HEADERS += mercurialplugin.h \
|
||||
srcdestdialog.h \
|
||||
mercurialcommitwidget.h \
|
||||
commiteditor.h \
|
||||
clonewizardpage.h \
|
||||
clonewizard.h \
|
||||
mercurialsettings.h \
|
||||
authenticationdialog.h
|
||||
FORMS += optionspage.ui \
|
||||
@@ -33,4 +29,3 @@ FORMS += optionspage.ui \
|
||||
srcdestdialog.ui \
|
||||
mercurialcommitpanel.ui \
|
||||
authenticationdialog.ui
|
||||
RESOURCES += mercurial.qrc
|
||||
|
||||
@@ -16,14 +16,9 @@ QtcPlugin {
|
||||
"authenticationdialog.cpp",
|
||||
"authenticationdialog.h",
|
||||
"authenticationdialog.ui",
|
||||
"clonewizard.cpp",
|
||||
"clonewizard.h",
|
||||
"clonewizardpage.cpp",
|
||||
"clonewizardpage.h",
|
||||
"commiteditor.cpp",
|
||||
"commiteditor.h",
|
||||
"constants.h",
|
||||
"mercurial.qrc",
|
||||
"mercurialclient.cpp",
|
||||
"mercurialclient.h",
|
||||
"mercurialcommitpanel.ui",
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/mercurial" >
|
||||
<file>images/hg.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "revertdialog.h"
|
||||
#include "srcdestdialog.h"
|
||||
#include "commiteditor.h"
|
||||
#include "clonewizard.h"
|
||||
#include "mercurialsettings.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
@@ -153,16 +152,6 @@ bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString *
|
||||
addAutoReleasedObject(new VcsSubmitEditorFactory(&submitEditorParameters,
|
||||
[]() { return new CommitEditor(&submitEditorParameters); }));
|
||||
|
||||
auto cloneWizardFactory = new BaseCheckoutWizardFactory;
|
||||
cloneWizardFactory->setId(QLatin1String(VcsBase::Constants::VCS_ID_MERCURIAL));
|
||||
cloneWizardFactory->setIcon(QIcon(QLatin1String(":/mercurial/images/hg.png")));
|
||||
cloneWizardFactory->setDescription(tr("Clones a Mercurial repository and tries to load the contained project."));
|
||||
cloneWizardFactory->setDisplayName(tr("Mercurial Clone"));
|
||||
cloneWizardFactory->setWizardCreator([this] (const FileName &path, QWidget *parent) {
|
||||
return new CloneWizard(path, parent);
|
||||
});
|
||||
addAutoReleasedObject(cloneWizardFactory);
|
||||
|
||||
const QString prefix = QLatin1String("hg");
|
||||
m_commandLocator = new Core::CommandLocator("Mercurial", prefix, prefix);
|
||||
addAutoReleasedObject(m_commandLocator);
|
||||
|
||||
Reference in New Issue
Block a user