Commit 4f4c6b62 authored by Tobias Hunger's avatar Tobias Hunger

CVS: Replace CVS checkout wizard with a Json wizard

Change-Id: I27c5c76923bae3e4df514e228873330fd8232c7f
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@theqtcompany.com>
Reviewed-by: default avatarLeena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 9a5aceb7
{
"version": 1,
"kind": "project",
"id": "Z.CVS",
"category": "T.Import",
"trDescription": "Checks out a CVS repository and tries to load the contained project.",
"trDisplayName": "CVS Checkout",
"trDisplayCategory": "Import Project",
"icon": "icon.png",
"featuresRequired": [ "Plugin.CVS" ],
"options":
[
{ "key": "vcsId", "value": "Z.CVS" },
{ "key": "vcsName", "value": "%{JS: Vcs.displayName('%{vcsId}')}" },
{ "key": "Dir", "value": "%{JS: '%{Repo}'.substr('%{Repo}'.lastIndexOf('/') + 1) }"},
{ "key": "TargetPath", "value": "%{Path}/%{Dir}" }
],
"pages":
[
{
"trDisplayName": "Configuration",
"trShortTitle": "Configuration",
"trSubTitle": "Please configure <b>%{vcsName}</b> now.",
"typeId": "VcsConfiguration",
"enabled": "%{JS: !Vcs.isConfigured('%{vcsId}')}",
"data": { "vcsId": "%{vcsId}" }
},
{
"trDisplayName": "Location",
"trShortTitle": "Location",
"trSubTitle": "Specify module and checkout directory.",
"typeId": "Fields",
"data" :
[
{
"name": "Repo",
"trDisplayName": "Module:",
"mandatory": true,
"type": "LineEdit"
},
{
"name": "Sp1",
"type": "Spacer",
"data": { "factor": 2 }
},
{
"name": "Path",
"trDisplayName": "Path:",
"type": "PathChooser",
"isComplete": "%{JS: '%{Dir}' === '' || !Util.exists('%{TargetPath}')}",
"trIncompleteMessage": "\"%{JS: Util.toNativeSeparators('%{TargetPath}')}\" exists in the filesystem.",
"data":
{
"kind": "existingDirectory",
"basePath": "%{InitialPath}",
"path": "%{InitialPath}"
}
}
]
},
{
"trDisplayName": "Checkout",
"trShortTitle": "Checkout",
"typeId": "VcsCommand",
"data" :
{
"vcsId": "%{vcsId}",
"trRunMessage": "Running CVS checkout...",
"repository": "%{Repo}",
"baseDirectory": "%{Path}",
"checkoutName": "%{Dir}"
}
}
],
"generators":
[
{
"typeId": "Scanner",
"data": {
"subdirectoryPatterns": [ "^src$" ]
}
}
]
}
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** 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 "checkoutwizard.h"
#include "checkoutwizardpage.h"
#include "cvsclient.h"
#include "cvsplugin.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 Cvs {
namespace Internal {
// --------------------------------------------------------------------
// CheckoutWizard:
// --------------------------------------------------------------------
CheckoutWizard::CheckoutWizard(const Utils::FileName &path, QWidget *parent) :
BaseCheckoutWizard(Constants::VCS_ID_CVS, parent)
{
auto cwp = new CheckoutWizardPage;
cwp->setPath(path.toString());
addPage(cwp);
}
VcsCommand *CheckoutWizard::createCommand(Utils::FileName *checkoutDir)
{
// Collect parameters for the checkout command.
// CVS does not allow for checking out into a different directory.
const CheckoutWizardPage *cwp = find<CheckoutWizardPage>();
QTC_ASSERT(cwp, return 0);
*checkoutDir = Utils::FileName::fromString(cwp->path() + QLatin1Char('/') + cwp->repository());
// cwp->repository() contains the CVS module to check out only.
// The CVSROOT (== actual repository) for that module is part of the CVS settings.
// The checkout will always go into a new subfolder named after the CVS module.
return createCommandImpl(cwp->repository(), Utils::FileName::fromString(cwp->path()),
cwp->repository(), QStringList());
}
} // namespace Internal
} // namespace Cvs
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** 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 CHECKOUTWIZARD_H
#define CHECKOUTWIZARD_H
#include <vcsbase/basecheckoutwizardfactory.h>
#include <vcsbase/basecheckoutwizard.h>
namespace Cvs {
namespace Internal {
class CheckoutWizard : public VcsBase::BaseCheckoutWizard
{
Q_OBJECT
public:
CheckoutWizard(const Utils::FileName &path, QWidget *parent = 0);
protected:
VcsBase::VcsCommand *createCommand(Utils::FileName *checkoutDir);
};
} // namespace Internal
} // namespace Cvs
#endif // CHECKOUTWIZARD_H
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** 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 "checkoutwizardpage.h"
namespace Cvs {
namespace Internal {
CheckoutWizardPage::CheckoutWizardPage(QWidget *parent) :
VcsBase::BaseCheckoutWizardPage(parent)
{
setTitle(tr("Location"));
setSubTitle(tr("Specify repository and path."));
setRepositoryLabel(tr("Repository:"));
setDirectoryVisible(false);
setBranchSelectorVisible(false);
}
} // namespace Internal
} // namespace Cvs
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** 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 CHECKOUTWIZARDPAGE_H
#define CHECKOUTWIZARDPAGE_H
#include <vcsbase/basecheckoutwizardpage.h>
namespace Cvs {
namespace Internal {
class CheckoutWizardPage : public VcsBase::BaseCheckoutWizardPage
{
Q_OBJECT
public:
CheckoutWizardPage(QWidget *parent = 0);
};
} // namespace Internal
} // namespace Cvs
#endif // CHECKOUTWIZARDPAGE_H
......@@ -9,9 +9,7 @@ HEADERS += annotationhighlighter.h \
cvssubmiteditor.h \
cvssettings.h \
cvsutils.h \
cvsconstants.h \
checkoutwizard.h \
checkoutwizardpage.h
cvsconstants.h
SOURCES += annotationhighlighter.cpp \
cvsplugin.cpp \
......@@ -21,9 +19,7 @@ SOURCES += annotationhighlighter.cpp \
cvseditor.cpp \
cvssubmiteditor.cpp \
cvssettings.cpp \
cvsutils.cpp \
checkoutwizard.cpp \
checkoutwizardpage.cpp
cvsutils.cpp
FORMS += settingspage.ui
......
......@@ -13,10 +13,6 @@ QtcPlugin {
files: [
"annotationhighlighter.cpp",
"annotationhighlighter.h",
"checkoutwizard.cpp",
"checkoutwizard.h",
"checkoutwizardpage.cpp",
"checkoutwizardpage.h",
"cvs.qrc",
"cvsclient.cpp",
"cvsclient.h",
......
......@@ -2,7 +2,4 @@
<qresource prefix="/trolltech.cvs">
<file>CVS.mimetypes.xml</file>
</qresource>
<qresource prefix="/cvs">
<file>images/cvs.png</file>
</qresource>
</RCC>
......@@ -149,6 +149,7 @@ Core::ShellCommand *CvsControl::createInitialCheckoutCommand(const QString &url,
auto command = new VcsBase::VcsCommand(baseDirectory.toString(),
QProcessEnvironment::systemEnvironment());
command->setDisplayName(tr("cvs checkout"));
command->addJob(m_plugin->client()->vcsBinary(), settings.addOptions(args), -1);
return command;
}
......
......@@ -35,7 +35,6 @@
#include "cvsclient.h"
#include "cvsconstants.h"
#include "cvscontrol.h"
#include "checkoutwizard.h"
#include <vcsbase/basevcseditorfactory.h>
#include <vcsbase/basevcssubmiteditorfactory.h>
......@@ -266,16 +265,6 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
for (int i = 0; i < editorCount; i++)
addAutoReleasedObject(new VcsEditorFactory(editorParameters + i, widgetCreator, this, describeSlotC));
auto checkoutWizardFactory = new BaseCheckoutWizardFactory;
checkoutWizardFactory->setId(QLatin1String(VcsBase::Constants::VCS_ID_CVS));
checkoutWizardFactory->setIcon(QIcon(QLatin1String(":/cvs/images/cvs.png")));
checkoutWizardFactory->setDescription(tr("Checks out a CVS repository and tries to load the contained project."));
checkoutWizardFactory->setDisplayName(tr("CVS Checkout"));
checkoutWizardFactory->setWizardCreator([this] (const FileName &path, QWidget *parent) {
return new CheckoutWizard(path, parent);
});
addAutoReleasedObject(checkoutWizardFactory);
const QString prefix = QLatin1String("cvs");
m_commandLocator = new CommandLocator("CVS", prefix, prefix);
addAutoReleasedObject(m_commandLocator);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment