diff --git a/src/plugins/mercurial/images/hg.png b/share/qtcreator/templates/wizards/projects/vcs/mercurial/icon.png similarity index 100% rename from src/plugins/mercurial/images/hg.png rename to share/qtcreator/templates/wizards/projects/vcs/mercurial/icon.png diff --git a/share/qtcreator/templates/wizards/projects/vcs/mercurial/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/mercurial/wizard.json new file mode 100644 index 00000000000..c3fd5c2f463 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/vcs/mercurial/wizard.json @@ -0,0 +1,98 @@ +{ + "version": 1, + "kind": "project", + "id": "H.Mercurial", + "category": "T.Import", + "trDescription": "Clones a Mercurial repository and tries to load the contained project.", + "trDisplayName": "Mercurial Clone", + "trDisplayCategory": "Import Project", + "icon": "icon.png", + "featuresRequired": [ "Plugin.Mercurial" ], + + "options": + [ + { "key": "vcsId", "value": "H.Mercurial" }, + { "key": "vcsName", "value": "%{JS: Vcs.displayName('%{vcsId}')}" }, + { "key": "SR", "value": "%{JS: '%{Repo}'.substr('%{Repo}'.indexOf(':') + 1) }"}, + { "key": "defaultDir", "value": "%{JS: '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/\\./, '-') }"}, + { "key": "TargetPath", "value": "%{Path}/%{Dir}" } + ], + + "pages": + [ + { + "trDisplayName": "Configuration", + "trShortTitle": "Configuration", + "trSubTitle": "Please configure %{vcsName} now.", + "typeId": "VcsConfiguration", + "enabled": "%{JS: !Vcs.isConfigured('%{vcsId}')}", + "data": { "vcsId": "%{vcsId}" } + }, + { + "trDisplayName": "Location", + "trShortTitle": "Location", + "trSubTitle": "Specify repository URL, checkout directory, and path.", + "typeId": "Fields", + "data" : + [ + { + "name": "Repo", + "trDisplayName": "Repository:", + "mandatory": true, + "type": "LineEdit" + }, + { + "name": "Sp1", + "type": "Spacer", + "data": { "factor": 2 } + }, + { + "name": "Path", + "trDisplayName": "Path:", + "type": "PathChooser", + "data": + { + "kind": "existingDirectory", + "basePath": "%{InitialPath}", + "path": "%{InitialPath}" + } + }, + { + "name": "Dir", + "trDisplayName": "Directory:", + "mandatory": true, + "type": "LineEdit", + "isComplete": "%{JS: '%{Dir}' === '' || !Util.exists('%{TargetPath}')}", + "trIncompleteMessage": "\"%{JS: Util.toNativeSeparators('%{TargetPath}')}\" exists in the filesystem.", + "data": + { + "trText": "%{defaultDir}" + } + } + ] + }, + { + "trDisplayName": "Checkout", + "trShortTitle": "Checkout", + "typeId": "VcsCommand", + "data" : + { + "vcsId": "%{vcsId}", + "trRunMessage": "Running Mercurial clone...", + "repository": "%{Repo}", + "baseDirectory": "%{Path}", + "checkoutName": "%{Dir}" + } + } + ], + + "generators": + [ + { + "typeId": "Scanner", + "data": { + "subdirectoryPatterns": [ "^src$" ] + } + } + ] +} diff --git a/src/plugins/mercurial/clonewizard.cpp b/src/plugins/mercurial/clonewizard.cpp deleted file mode 100644 index 1ac5e63fa58..00000000000 --- a/src/plugins/mercurial/clonewizard.cpp +++ /dev/null @@ -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 -#include -#include -#include - -#include - -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(); - 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 diff --git a/src/plugins/mercurial/clonewizard.h b/src/plugins/mercurial/clonewizard.h deleted file mode 100644 index 798f4e962c5..00000000000 --- a/src/plugins/mercurial/clonewizard.h +++ /dev/null @@ -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 -#include - -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 diff --git a/src/plugins/mercurial/clonewizardpage.cpp b/src/plugins/mercurial/clonewizardpage.cpp deleted file mode 100644 index 34507a991c7..00000000000 --- a/src/plugins/mercurial/clonewizardpage.cpp +++ /dev/null @@ -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 diff --git a/src/plugins/mercurial/clonewizardpage.h b/src/plugins/mercurial/clonewizardpage.h deleted file mode 100644 index 753b84674c4..00000000000 --- a/src/plugins/mercurial/clonewizardpage.h +++ /dev/null @@ -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 - -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 diff --git a/src/plugins/mercurial/mercurial.pro b/src/plugins/mercurial/mercurial.pro index a10510d5a1b..69f250bd2db 100644 --- a/src/plugins/mercurial/mercurial.pro +++ b/src/plugins/mercurial/mercurial.pro @@ -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 diff --git a/src/plugins/mercurial/mercurial.qbs b/src/plugins/mercurial/mercurial.qbs index 3198da245c5..a168c5a4310 100644 --- a/src/plugins/mercurial/mercurial.qbs +++ b/src/plugins/mercurial/mercurial.qbs @@ -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", diff --git a/src/plugins/mercurial/mercurial.qrc b/src/plugins/mercurial/mercurial.qrc deleted file mode 100644 index b001b7e60b5..00000000000 --- a/src/plugins/mercurial/mercurial.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - images/hg.png - - diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp index dd13a0f2a90..e9e70c4768c 100644 --- a/src/plugins/mercurial/mercurialplugin.cpp +++ b/src/plugins/mercurial/mercurialplugin.cpp @@ -37,7 +37,6 @@ #include "revertdialog.h" #include "srcdestdialog.h" #include "commiteditor.h" -#include "clonewizard.h" #include "mercurialsettings.h" #include @@ -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);