diff options
author | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2015-05-06 16:48:07 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2015-05-15 09:11:44 +0000 |
commit | 0b91b77cdc87fb60e3a4ca11fe2cf40bead4e06f (patch) | |
tree | 3181001dd67b43d664443b5992bda819e1bfeaad | |
parent | 4f4c6b6288fde5291a817c625c85d03fd4818b24 (diff) | |
download | qt-creator-0b91b77cdc87fb60e3a4ca11fe2cf40bead4e06f.tar.gz |
Subversion: Replace Subversion Checkout wizard
Replace the subversion checkout wizard with a Json wizard.
Change-Id: I969ff00e2e6fdc8088f8c7a928f80454cd987164
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
-rw-r--r-- | share/qtcreator/templates/wizards/projects/vcs/subversion/icon.png (renamed from src/plugins/subversion/images/subversion.png) | bin | 875 -> 875 bytes | |||
-rw-r--r-- | share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json | 109 | ||||
-rw-r--r-- | src/plugins/subversion/checkoutwizard.cpp | 80 | ||||
-rw-r--r-- | src/plugins/subversion/checkoutwizard.h | 54 | ||||
-rw-r--r-- | src/plugins/subversion/checkoutwizardpage.cpp | 72 | ||||
-rw-r--r-- | src/plugins/subversion/checkoutwizardpage.h | 59 | ||||
-rw-r--r-- | src/plugins/subversion/subversion.pro | 6 | ||||
-rw-r--r-- | src/plugins/subversion/subversion.qbs | 4 | ||||
-rw-r--r-- | src/plugins/subversion/subversion.qrc | 3 | ||||
-rw-r--r-- | src/plugins/subversion/subversionplugin.cpp | 11 |
10 files changed, 110 insertions, 288 deletions
diff --git a/src/plugins/subversion/images/subversion.png b/share/qtcreator/templates/wizards/projects/vcs/subversion/icon.png Binary files differindex 17308b5ebb..17308b5ebb 100644 --- a/src/plugins/subversion/images/subversion.png +++ b/share/qtcreator/templates/wizards/projects/vcs/subversion/icon.png diff --git a/share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json new file mode 100644 index 0000000000..3fc18ef8c4 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json @@ -0,0 +1,109 @@ +{ + "version": 1, + "kind": "project", + "id": "J.Subversion", + "category": "T.Import", + "trDescription": "Checks out a Subversion repository and tries to load the contained project.", + "trDisplayName": "Subversion Checkout", + "trDisplayCategory": "Import Project", + "icon": "icon.png", + "featuresRequired": [ "Plugin.Subversion" ], + + "options": + [ + { "key": "vcsId", "value": "J.Subversion" }, + { "key": "vcsName", "value": "%{JS: Vcs.displayName('%{vcsId}')}" }, + { "key": "SR", "value": "%{JS: '%{Repo}'.replace(/\\/trunk$/, '').replace(/\\/$/, '') }"}, + { "key": "defaultDir", "value": "%{JS: '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/\\./, '-') }"}, + { "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 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}" + } + }, + { + "name": "TrustCert", + "trDisplayName": "Trust Server Certificate", + "type": "CheckBox", + "data": + { + "checkedValue": "--trust-server-cert", + "uncheckedValue": "" + } + } + ] + }, + { + "trDisplayName": "Checkout", + "trShortTitle": "Checkout", + "typeId": "VcsCommand", + "data" : + { + "vcsId": "%{vcsId}", + "trRunMessage": "Running Subversion checkout...", + "repository": "%{Repo}", + "baseDirectory": "%{Path}", + "checkoutName": "%{Dir}", + "extraArguments": [ "%{TrustCert}" ] + } + } + ], + + "generators": + [ + { + "typeId": "Scanner", + "data": { + "subdirectoryPatterns": [ "^src$" ] + } + } + ] +} diff --git a/src/plugins/subversion/checkoutwizard.cpp b/src/plugins/subversion/checkoutwizard.cpp deleted file mode 100644 index a1c6348a34..0000000000 --- a/src/plugins/subversion/checkoutwizard.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** 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 "subversionconstants.h" -#include "subversionplugin.h" -#include "subversionclient.h" - -#include <coreplugin/iversioncontrol.h> -#include <vcsbase/vcscommand.h> -#include <vcsbase/vcsbaseconstants.h> -#include <vcsbase/wizard/vcsconfigurationpage.h> -#include <utils/qtcassert.h> - -using namespace Utils; -using namespace VcsBase; - -namespace Subversion { -namespace Internal { - -// -------------------------------------------------------------------- -// CheckoutWizard: -// -------------------------------------------------------------------- - -CheckoutWizard::CheckoutWizard(const FileName &path, QWidget *parent) : - BaseCheckoutWizard(VcsBase::Constants::VCS_ID_SUBVERSION, parent) -{ - auto cwp = new CheckoutWizardPage; - cwp->setPath(path.toString()); - addPage(cwp); -} - -VcsCommand *CheckoutWizard::createCommand(FileName *checkoutDir) -{ - // Collect parameters for the checkout command. - const CheckoutWizardPage *cwp = find<CheckoutWizardPage>(); - QTC_ASSERT(cwp, return 0); - - QStringList args; - if (cwp->trustServerCert()) - args << QLatin1String("--trust-server-cert"); - const QString directory = cwp->directory(); - const QString workingDirectory = cwp->path(); - - *checkoutDir = FileName::fromString(workingDirectory + QLatin1Char('/') + directory); - - return createCommandImpl(cwp->repository(), Utils::FileName::fromString(workingDirectory), - directory, args); -} - -} // namespace Internal -} // namespace Subversion diff --git a/src/plugins/subversion/checkoutwizard.h b/src/plugins/subversion/checkoutwizard.h deleted file mode 100644 index 4bdd9a79fc..0000000000 --- a/src/plugins/subversion/checkoutwizard.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** 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 Subversion { -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 Subversion - -#endif // CHECKOUTWIZARD_H diff --git a/src/plugins/subversion/checkoutwizardpage.cpp b/src/plugins/subversion/checkoutwizardpage.cpp deleted file mode 100644 index 0f96b79813..0000000000 --- a/src/plugins/subversion/checkoutwizardpage.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** 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" - -#include <QCheckBox> - -namespace Subversion { -namespace Internal { - -CheckoutWizardPage::CheckoutWizardPage(QWidget *parent) : - VcsBase::BaseCheckoutWizardPage(parent), - m_trustServerCertBox(new QCheckBox(tr("Trust Server Certificate"))) -{ - setTitle(tr("Location")); - setSubTitle(tr("Specify repository URL, checkout directory and path.")); - setRepositoryLabel(tr("Repository:")); - setBranchSelectorVisible(false); - - addLocalControl(m_trustServerCertBox); -} - -bool CheckoutWizardPage::trustServerCert() const -{ - return m_trustServerCertBox->isChecked(); -} - -QString CheckoutWizardPage::directoryFromRepository(const QString &repoIn) const -{ - /* Try to figure out a good directory name from something like: - * "svn://<server>/path1/project" -> project */ - - QString repo = repoIn.trimmed(); - const QChar slash = QLatin1Char('/'); - // remove host - const int slashPos = repo.lastIndexOf(slash); - if (slashPos != -1) - repo.remove(0, slashPos + 1); - // fix invalid characters - repo.replace(QLatin1Char('.'), QLatin1Char('-')); - return repo; -} - -} // namespace Internal -} // namespace Subversion diff --git a/src/plugins/subversion/checkoutwizardpage.h b/src/plugins/subversion/checkoutwizardpage.h deleted file mode 100644 index 7d941563fe..0000000000 --- a/src/plugins/subversion/checkoutwizardpage.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** 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> - -QT_BEGIN_NAMESPACE -class QCheckBox; -QT_END_NAMESPACE - -namespace Subversion { -namespace Internal { - -class CheckoutWizardPage : public VcsBase::BaseCheckoutWizardPage { - Q_OBJECT -public: - CheckoutWizardPage(QWidget *parent = 0); - - bool trustServerCert() const; - -protected: - QString directoryFromRepository(const QString &r) const; - -private: - QCheckBox *m_trustServerCertBox; -}; - -} // namespace Internal -} // namespace Subversion -#endif // CHECKOUTWIZARDPAGE_H diff --git a/src/plugins/subversion/subversion.pro b/src/plugins/subversion/subversion.pro index ae8e211b62..ebf878474b 100644 --- a/src/plugins/subversion/subversion.pro +++ b/src/plugins/subversion/subversion.pro @@ -8,8 +8,6 @@ HEADERS += annotationhighlighter.h \ subversioneditor.h \ subversionsubmiteditor.h \ subversionsettings.h \ - checkoutwizard.h \ - checkoutwizardpage.h \ subversionconstants.h SOURCES += annotationhighlighter.cpp \ @@ -19,9 +17,7 @@ SOURCES += annotationhighlighter.cpp \ settingspage.cpp \ subversioneditor.cpp \ subversionsubmiteditor.cpp \ - subversionsettings.cpp \ - checkoutwizard.cpp \ - checkoutwizardpage.cpp + subversionsettings.cpp FORMS += settingspage.ui diff --git a/src/plugins/subversion/subversion.qbs b/src/plugins/subversion/subversion.qbs index dd38509ad5..1a6244a946 100644 --- a/src/plugins/subversion/subversion.qbs +++ b/src/plugins/subversion/subversion.qbs @@ -14,10 +14,6 @@ QtcPlugin { files: [ "annotationhighlighter.cpp", "annotationhighlighter.h", - "checkoutwizard.cpp", - "checkoutwizard.h", - "checkoutwizardpage.cpp", - "checkoutwizardpage.h", "settingspage.cpp", "settingspage.h", "settingspage.ui", diff --git a/src/plugins/subversion/subversion.qrc b/src/plugins/subversion/subversion.qrc index ca81748ffb..b23e6dbb97 100644 --- a/src/plugins/subversion/subversion.qrc +++ b/src/plugins/subversion/subversion.qrc @@ -1,7 +1,4 @@ <RCC> - <qresource prefix="/subversion"> - <file>images/subversion.png</file> - </qresource> <qresource prefix="/trolltech.subversion"> <file>Subversion.mimetypes.xml</file> </qresource> diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 75639bf624..f83252c497 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -37,7 +37,6 @@ #include "subversionclient.h" #include "subversionconstants.h" #include "subversioncontrol.h" -#include "checkoutwizard.h" #include <vcsbase/basevcseditorfactory.h> #include <vcsbase/vcscommand.h> @@ -260,16 +259,6 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e for (int i = 0; i < editorCount; i++) addAutoReleasedObject(new VcsEditorFactory(editorParameters + i, widgetCreator, this, describeSlot)); - auto checkoutWizardFactory = new BaseCheckoutWizardFactory; - checkoutWizardFactory->setId(QLatin1String(VcsBase::Constants::VCS_ID_SUBVERSION)); - checkoutWizardFactory->setIcon(QIcon(QLatin1String(":/subversion/images/subversion.png"))); - checkoutWizardFactory->setDescription(tr("Checks out a Subversion repository and tries to load the contained project.")); - checkoutWizardFactory->setDisplayName(tr("Subversion Checkout")); - checkoutWizardFactory->setWizardCreator([this] (const FileName &path, QWidget *parent) { - return new CheckoutWizard(path, parent); - }); - addAutoReleasedObject(checkoutWizardFactory); - const QString prefix = QLatin1String("svn"); m_commandLocator = new CommandLocator("Subversion", prefix, prefix); addAutoReleasedObject(m_commandLocator); |