diff options
author | Tobias Hunger <[email protected]> | 2015-05-12 16:12:48 +0200 |
---|---|---|
committer | Tobias Hunger <[email protected]> | 2015-05-18 13:43:39 +0000 |
commit | 3d0b690d315e4006caf505a91143b75f492b6ecc (patch) | |
tree | a949a59dd657684d5580d0522598329f047771df /src/plugins | |
parent | bf249dc66094ff71a4d2f65b7504d0f5048af809 (diff) |
Git: Replace CloneWizard with a Json wizard
Change-Id: I2188c083665acc239bc98bf857ff57b071805fbc
Reviewed-by: Orgad Shaneh <[email protected]>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/git/clonewizard.cpp | 85 | ||||
-rw-r--r-- | src/plugins/git/clonewizard.h | 54 | ||||
-rw-r--r-- | src/plugins/git/clonewizardpage.cpp | 141 | ||||
-rw-r--r-- | src/plugins/git/clonewizardpage.h | 67 | ||||
-rw-r--r-- | src/plugins/git/git.pro | 4 | ||||
-rw-r--r-- | src/plugins/git/git.qbs | 4 | ||||
-rw-r--r-- | src/plugins/git/git.qrc | 1 | ||||
-rw-r--r-- | src/plugins/git/gitplugin.cpp | 33 | ||||
-rw-r--r-- | src/plugins/git/gitplugin.h | 2 | ||||
-rw-r--r-- | src/plugins/git/images/git.png | bin | 466 -> 0 bytes | |||
-rw-r--r-- | src/plugins/vcsbase/basecheckoutwizard.cpp | 136 | ||||
-rw-r--r-- | src/plugins/vcsbase/basecheckoutwizard.h | 80 | ||||
-rw-r--r-- | src/plugins/vcsbase/basecheckoutwizardfactory.cpp | 163 | ||||
-rw-r--r-- | src/plugins/vcsbase/basecheckoutwizardfactory.h | 64 | ||||
-rw-r--r-- | src/plugins/vcsbase/basecheckoutwizardpage.cpp | 262 | ||||
-rw-r--r-- | src/plugins/vcsbase/basecheckoutwizardpage.h | 110 | ||||
-rw-r--r-- | src/plugins/vcsbase/basecheckoutwizardpage.ui | 156 | ||||
-rw-r--r-- | src/plugins/vcsbase/vcsbase.pro | 7 | ||||
-rw-r--r-- | src/plugins/vcsbase/vcsbase.qbs | 7 |
19 files changed, 0 insertions, 1376 deletions
diff --git a/src/plugins/git/clonewizard.cpp b/src/plugins/git/clonewizard.cpp deleted file mode 100644 index 4e2cfcb53ec..00000000000 --- a/src/plugins/git/clonewizard.cpp +++ /dev/null @@ -1,85 +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 "clonewizard.h" -#include "clonewizardpage.h" - -#include "gitplugin.h" -#include "gitversioncontrol.h" - -#include <vcsbase/vcsbaseconstants.h> -#include <vcsbase/wizard/vcsconfigurationpage.h> -#include <utils/qtcassert.h> - -using namespace VcsBase; - -namespace Git { -namespace Internal { - -// -------------------------------------------------------------------- -// CloneWizard: -// -------------------------------------------------------------------- - -CloneWizard::CloneWizard(const Utils::FileName &path, QWidget *parent) : - BaseCheckoutWizard(Constants::VCS_ID_GIT, parent) -{ - setTitle(tr("Cloning")); - setStartedStatus(tr("Cloning started...")); - - auto cwp = new CloneWizardPage; - cwp->setPath(path.toString()); - addPage(cwp); -} - -VcsCommand *CloneWizard::createCommand(Utils::FileName *checkoutDir) -{ - // Collect parameters for the clone command. - const CloneWizardPage *cwp = find<CloneWizardPage>(); - QTC_ASSERT(cwp, return 0); - - const QString baseDirectory = cwp->path(); - const QString subDirectory = cwp->directory(); - - *checkoutDir = Utils::FileName::fromString(baseDirectory + QLatin1Char('/') + subDirectory); - - const QString checkoutBranch = cwp->branch(); - - QStringList args; - if (!checkoutBranch.isEmpty()) - args << QLatin1String("--branch") << checkoutBranch; - if (cwp->isRecursive()) - args << QLatin1String("--recursive"); - - return createCommandImpl(cwp->repository(), Utils::FileName::fromString(baseDirectory), - subDirectory, args); -} - -} // namespace Internal -} // namespace Git diff --git a/src/plugins/git/clonewizard.h b/src/plugins/git/clonewizard.h deleted file mode 100644 index 72a00704b70..00000000000 --- a/src/plugins/git/clonewizard.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 CLONEWIZARD_H -#define CLONEWIZARD_H - -#include <vcsbase/basecheckoutwizardfactory.h> -#include <vcsbase/basecheckoutwizard.h> - -namespace Git { -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) override; -}; - -} // namespace Internal -} // namespace Git - -#endif // CLONEWIZARD_H diff --git a/src/plugins/git/clonewizardpage.cpp b/src/plugins/git/clonewizardpage.cpp deleted file mode 100644 index feb936593b2..00000000000 --- a/src/plugins/git/clonewizardpage.cpp +++ /dev/null @@ -1,141 +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 "clonewizardpage.h" -#include "gitplugin.h" -#include "gitclient.h" - -#include <vcsbase/vcscommand.h> - -#include <QCheckBox> - -using namespace VcsBase; - -namespace Git { - -struct CloneWizardPagePrivate -{ - CloneWizardPagePrivate(); - - bool urlIsLocal(const QString &url); - - const QString mainLinePostfix; - const QString gitPostFix; - QCheckBox *recursiveCheckBox; -}; - -CloneWizardPagePrivate::CloneWizardPagePrivate() : - mainLinePostfix(QLatin1String("/mainline.git")), - gitPostFix(QLatin1String(".git")), - recursiveCheckBox(0) -{ -} - -bool CloneWizardPagePrivate::urlIsLocal(const QString &url) -{ - if (url.startsWith(QLatin1String("file://")) - || url.startsWith(QLatin1Char('/')) - || (url.at(0).isLetter() && url.at(1) == QLatin1Char(':') && url.at(2) == QLatin1Char('\\'))) - return true; - return false; -} - -CloneWizardPage::CloneWizardPage(QWidget *parent) : - BaseCheckoutWizardPage(parent), - d(new CloneWizardPagePrivate) -{ - setTitle(tr("Location")); - setSubTitle(tr("Specify repository URL, checkout directory and path.")); - setRepositoryLabel(tr("Clone URL:")); - d->recursiveCheckBox = new QCheckBox(tr("Recursive")); - addLocalControl(d->recursiveCheckBox); -} - -CloneWizardPage::~CloneWizardPage() -{ - delete d; -} - -QString CloneWizardPage::directoryFromRepository(const QString &urlIn) const -{ - const QChar slash = QLatin1Char('/'); - QString url = urlIn.trimmed().replace(QLatin1Char('\\'), slash); - - // Remove postfixes - if (url.endsWith(d->mainLinePostfix)) - url.truncate(url.size() - d->mainLinePostfix.size()); - else if (url.endsWith(d->gitPostFix)) - url.truncate(url.size() - d->gitPostFix.size()); - - // extract repository name (last part of path) - int startOfRepoName = url.lastIndexOf(slash); - if (startOfRepoName == -1) - startOfRepoName = url.lastIndexOf(QLatin1Char(':')); - url.remove(0, startOfRepoName); - - // fix invalid characters - const QChar dash = QLatin1Char('-'); - url.replace(QRegExp(QLatin1String("[^0-9a-zA-Z_.-]")), dash); - // trim leading dashes (they are annoying and get created when using local pathes) - url.replace(QRegExp(QLatin1String("^-+")), QString()); - return url; -} - -QStringList CloneWizardPage::branches(const QString &repository, int *current) -{ - // Run git on remote repository if an URL was specified. - *current = -1; - - if (repository.isEmpty()) - return QStringList(); - const QStringList branches = Internal::GitPlugin::instance()->client()->synchronousRepositoryBranches(repository); - if (!branches.isEmpty()) - *current = 0; // default branch is always returned first! - return branches; -} - -bool CloneWizardPage::isRecursive() const -{ - return d->recursiveCheckBox->isChecked(); -} - -} // namespace Git - -#ifdef WITH_TESTS -#include <QTest> - -void Git::CloneWizardPage::testDirectoryFromRepository() -{ - QFETCH(QString, repository); - QFETCH(QString, localDirectory); - - QCOMPARE(directoryFromRepository(repository), localDirectory); -} -#endif diff --git a/src/plugins/git/clonewizardpage.h b/src/plugins/git/clonewizardpage.h deleted file mode 100644 index 4b14c6a3d36..00000000000 --- a/src/plugins/git/clonewizardpage.h +++ /dev/null @@ -1,67 +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 CLONEWIZARDPAGE_H -#define CLONEWIZARDPAGE_H - -#include <vcsbase/basecheckoutwizardpage.h> - -#include <utils/fileutils.h> - -namespace VcsBase { class VcsCommand; } - -namespace Git { - -struct CloneWizardPagePrivate; - -class CloneWizardPage : public VcsBase::BaseCheckoutWizardPage -{ - Q_OBJECT -public: - explicit CloneWizardPage(QWidget *parent = 0); - ~CloneWizardPage(); - - QStringList branches(const QString &repository, int *current) override; - bool isRecursive() const; - -protected: - QString directoryFromRepository(const QString &r) const override; - -#ifdef WITH_TESTS -public: - void testDirectoryFromRepository(); -#endif - -private: - CloneWizardPagePrivate *d; -}; - -} // namespace Git -#endif // CLONEWIZARDPAGE_H diff --git a/src/plugins/git/git.pro b/src/plugins/git/git.pro index dba0e3733ca..9f8846e7b06 100644 --- a/src/plugins/git/git.pro +++ b/src/plugins/git/git.pro @@ -13,8 +13,6 @@ HEADERS += gitplugin.h \ gitsettings.h \ branchdialog.h \ branchmodel.h \ - clonewizard.h \ - clonewizardpage.h \ stashdialog.h \ gitutils.h \ remotemodel.h \ @@ -38,8 +36,6 @@ SOURCES += gitplugin.cpp \ gitsettings.cpp \ branchdialog.cpp \ branchmodel.cpp \ - clonewizard.cpp \ - clonewizardpage.cpp \ stashdialog.cpp \ gitutils.cpp \ remotemodel.cpp \ diff --git a/src/plugins/git/git.qbs b/src/plugins/git/git.qbs index 381168e73a1..5b1180033c2 100644 --- a/src/plugins/git/git.qbs +++ b/src/plugins/git/git.qbs @@ -28,10 +28,6 @@ QtcPlugin { "changeselectiondialog.cpp", "changeselectiondialog.h", "changeselectiondialog.ui", - "clonewizard.cpp", - "clonewizard.h", - "clonewizardpage.cpp", - "clonewizardpage.h", "commitdata.cpp", "commitdata.h", "git.qrc", diff --git a/src/plugins/git/git.qrc b/src/plugins/git/git.qrc index bab9c15f27a..f7c801436ad 100644 --- a/src/plugins/git/git.qrc +++ b/src/plugins/git/git.qrc @@ -1,6 +1,5 @@ <RCC> <qresource prefix="/git"> - <file>images/git.png</file> <file>images/arrowup.png</file> <file>Git.mimetypes.xml</file> </qresource> diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 4d4fdb243d8..708ca4bd37e 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -39,7 +39,6 @@ #include "gitversioncontrol.h" #include "branchdialog.h" #include "remotedialog.h" -#include "clonewizard.h" #include "stashdialog.h" #include "settingspage.h" #include "logchangedialog.h" @@ -86,7 +85,6 @@ #include <QScopedPointer> #ifdef WITH_TESTS -#include "clonewizardpage.h" #include <QTest> #endif @@ -290,16 +288,6 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) addAutoReleasedObject(new VcsSubmitEditorFactory(&submitParameters, []() { return new GitSubmitEditor(&submitParameters); })); - auto cloneWizardFactory = new BaseCheckoutWizardFactory; - cloneWizardFactory->setId(QLatin1String(VcsBase::Constants::VCS_ID_GIT)); - cloneWizardFactory->setIcon(QIcon(QLatin1String(":/git/images/git.png"))); - cloneWizardFactory->setDescription(tr("Clones a Git repository and tries to load the contained project.")); - cloneWizardFactory->setDisplayName(tr("Git Repository Clone")); - cloneWizardFactory->setWizardCreator([this] (const FileName &path, QWidget *parent) { - return new CloneWizard(path, parent); - }); - addAutoReleasedObject(cloneWizardFactory); - const QString prefix = QLatin1String("git"); m_commandLocator = new CommandLocator("Git", prefix, prefix); addAutoReleasedObject(m_commandLocator); @@ -1540,27 +1528,6 @@ void GitPlugin::testLogResolving() "50a6b54c - Merge branch 'for-junio' of git://bogomips.org/git-svn", "3587b513 - Update draft release notes to 1.8.2"); } - -void GitPlugin::testCloneWizard_directoryFromRepository() -{ - CloneWizardPage page; - page.testDirectoryFromRepository(); -} - -void GitPlugin::testCloneWizard_directoryFromRepository_data() -{ - QTest::addColumn<QString>("repository"); - QTest::addColumn<QString>("localDirectory"); - - QTest::newRow("http") << "http://host/qt/qt.git" << "qt"; - QTest::newRow("without slash") << "user@host:qt.git" << "qt"; - QTest::newRow("mainline.git") << "git://gitorious.org/gitorious/mainline.git" << "gitorious"; - QTest::newRow("local repo (Unix)") << "/home/user/qt-creator.git" << "qt-creator"; - QTest::newRow("local repo (Windows)") << "c:\\repos\\qt-creator.git" << "qt-creator"; - QTest::newRow("ssh with port") << "ssh://host:29418/qt/qt.git" << "qt"; - QTest::newRow("invalid chars removed") << "ssh://host/in%va$lid.git" << "in-va-lid"; - QTest::newRow("leading dashs removed") << "https://gerrit.local/--leadingDash" << "leadingDash"; -} #endif } // namespace Internal diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index 84d640b405f..d2219a535be 100644 --- a/src/plugins/git/gitplugin.h +++ b/src/plugins/git/gitplugin.h @@ -143,8 +143,6 @@ private slots: void testDiffFileResolving_data(); void testDiffFileResolving(); void testLogResolving(); - void testCloneWizard_directoryFromRepository(); - void testCloneWizard_directoryFromRepository_data(); #endif protected: void updateActions(VcsBase::VcsBasePlugin::ActionState) override; diff --git a/src/plugins/git/images/git.png b/src/plugins/git/images/git.png Binary files differdeleted file mode 100644 index 8895fe0165d..00000000000 --- a/src/plugins/git/images/git.png +++ /dev/null diff --git a/src/plugins/vcsbase/basecheckoutwizard.cpp b/src/plugins/vcsbase/basecheckoutwizard.cpp deleted file mode 100644 index 6717a2d71df..00000000000 --- a/src/plugins/vcsbase/basecheckoutwizard.cpp +++ /dev/null @@ -1,136 +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 "basecheckoutwizard.h" -#include "basecheckoutwizardfactory.h" -#include "vcscommand.h" -#include "wizard/vcsconfigurationpage.h" - -#include <coreplugin/iversioncontrol.h> -#include <coreplugin/vcsmanager.h> - -#include <utils/qtcassert.h> -#include <utils/shellcommandpage.h> - -#include <QPushButton> - -/*! - \class VcsBase::Internal::CheckoutWizardDialog - - Dialog used by \sa VcsBase::BaseCheckoutWizard. Overwrites reject() to first - kill the checkout and then close. - */ - -namespace VcsBase { - -BaseCheckoutWizard::BaseCheckoutWizard(Core::Id vcsId, QWidget *parent) : - Utils::Wizard(parent), - m_progressPage(new Utils::ShellCommandPage), - m_progressPageId(-1), - m_vcsId(vcsId) -{ - connect(this, &QWizard::currentIdChanged, this, &BaseCheckoutWizard::slotPageChanged); - connect(m_progressPage, &Utils::ShellCommandPage::finished, - this, &BaseCheckoutWizard::slotTerminated); - setOption(QWizard::NoBackButtonOnLastPage); - - const Core::IVersionControl *vc = Core::VcsManager::versionControl(vcsId); - QTC_ASSERT(vc, return); - - if (!vc->isConfigured()) { - auto configPage = new VcsConfigurationPage; - configPage->setVersionControl(vc); - addPage(configPage); - } -} - -void BaseCheckoutWizard::setTitle(const QString &title) -{ - m_progressPage->setTitle(title); -} - -void BaseCheckoutWizard::setStartedStatus(const QString &title) -{ - m_progressPage->setStartedStatus(title); -} - -void BaseCheckoutWizard::slotPageChanged(int id) -{ - if (id != m_progressPageId) - return; - - VcsBase::VcsCommand *cmd = createCommand(&m_checkoutDir); - QTC_ASSERT(cmd, done(QDialog::Rejected)); - - // No "back" available while running. - button(QWizard::BackButton)->setEnabled(false); - m_progressPage->start(cmd); -} - -void BaseCheckoutWizard::slotTerminated(bool success) -{ - // Allow to correct parameters - if (!success) - button(QWizard::BackButton)->setEnabled(true); -} - -Utils::FileName BaseCheckoutWizard::run() -{ - m_progressPageId = addPage(m_progressPage); - if (Utils::Wizard::exec() == QDialog::Accepted) - return m_checkoutDir; - else - return Utils::FileName(); -} - -VcsCommand *BaseCheckoutWizard::createCommandImpl(const QString &url, - const Utils::FileName &baseDirectory, - const QString &localName, - const QStringList &extraArgs) -{ - Core::IVersionControl *vc = Core::VcsManager::versionControl(m_vcsId); - QTC_ASSERT(vc, return 0); - QTC_ASSERT(vc->isConfigured(), return 0); - QTC_ASSERT(vc->supportsOperation(Core::IVersionControl::InitialCheckoutOperation), return 0); - - return static_cast<VcsCommand *>(vc->createInitialCheckoutCommand(url, baseDirectory, - localName, extraArgs)); -} - -void BaseCheckoutWizard::reject() -{ - // First click kills, 2nd closes - if (currentId() == m_progressPageId && m_progressPage->isRunning()) - m_progressPage->terminate(); - else - QWizard::reject(); -} - -} // namespace VcsBase diff --git a/src/plugins/vcsbase/basecheckoutwizard.h b/src/plugins/vcsbase/basecheckoutwizard.h deleted file mode 100644 index e014986117a..00000000000 --- a/src/plugins/vcsbase/basecheckoutwizard.h +++ /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. -** -****************************************************************************/ - -#ifndef BASECHECKOUTWIZARD_H -#define BASECHECKOUTWIZARD_H - -#include "vcsbase_global.h" - -#include <coreplugin/id.h> - -#include <utils/fileutils.h> -#include <utils/wizard.h> - -namespace Utils { class ShellCommandPage; } - -namespace VcsBase { -class VcsCommand; - -class VCSBASE_EXPORT BaseCheckoutWizard : public Utils::Wizard -{ - Q_OBJECT - -public: - explicit BaseCheckoutWizard(Core::Id vcsId, QWidget *parent = 0); - - void setTitle(const QString &title); - void setStartedStatus(const QString &title); - - Utils::FileName run(); - -protected: - virtual VcsBase::VcsCommand *createCommand(Utils::FileName *checkoutDir) = 0; - - VcsBase::VcsCommand *createCommandImpl(const QString &url, - const Utils::FileName &baseDirectory, - const QString &localName, - const QStringList &extraArgs); - -private slots: - void slotPageChanged(int id); - void slotTerminated(bool success); - virtual void reject(); - -private: - Utils::ShellCommandPage *m_progressPage; - Utils::FileName m_checkoutDir; - int m_progressPageId; - Core::Id m_vcsId; -}; - -} // namespace VcsBase - -#endif // BASECHECKOUTWIZARD_H diff --git a/src/plugins/vcsbase/basecheckoutwizardfactory.cpp b/src/plugins/vcsbase/basecheckoutwizardfactory.cpp deleted file mode 100644 index dfb29ccc6b9..00000000000 --- a/src/plugins/vcsbase/basecheckoutwizardfactory.cpp +++ /dev/null @@ -1,163 +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 "basecheckoutwizardfactory.h" -#include "basecheckoutwizard.h" - -#include <coreplugin/icontext.h> -#include <coreplugin/icore.h> -#include <coreplugin/featureprovider.h> - -#include <projectexplorer/projectexplorer.h> - -#include <utils/fileutils.h> -#include <utils/qtcassert.h> - -#include <QCoreApplication> -#include <QDir> -#include <QMessageBox> -#include <QScopedPointer> - -/*! - \class VcsBase::BaseCheckoutWizard - - \brief The BaseCheckoutWizard class implements a wizard for initially - checking out a project using a version control system. - - Implements all of Core::IWizard with the exception of - name()/description() and icon(). - - Pops up a QWizard consisting of a Parameter Page which is created - by a virtual factory function and a progress - page containing a log text. The factory function createJob() - creates a job with the output connected to the log window, - returning the path to the checkout. - - On success, the wizard tries to locate a project file - and open it. - - \sa VcsBase::BaseCheckoutWizardPage -*/ - -namespace VcsBase { - -BaseCheckoutWizardFactory::BaseCheckoutWizardFactory() -{ - setWizardKind(IWizardFactory::ProjectWizard); - setCategory(QLatin1String(ProjectExplorer::Constants::IMPORT_WIZARD_CATEGORY)); - setDisplayCategory(QCoreApplication::translate("ProjectExplorer", - ProjectExplorer::Constants::IMPORT_WIZARD_CATEGORY_DISPLAY)); - setFlags(Core::IWizardFactory::PlatformIndependent); -} - -void BaseCheckoutWizardFactory::runWizard(const QString &path, QWidget *parent, const QString &platform, - const QVariantMap &extraValues) -{ - Q_UNUSED(platform); - Q_UNUSED(extraValues); - // Create dialog and launch - - Utils::FileName checkoutPath; - { - QScopedPointer<BaseCheckoutWizard> wizard(m_wizardCreator(Utils::FileName::fromString(path), parent)); - wizard->setWindowTitle(displayName()); - Core::ICore::registerWindow(wizard.data(), Core::Context("New.CheckoutWizard")); - checkoutPath = wizard->run(); - } - - if (checkoutPath.isEmpty()) - return; - - // Now try to find the project file and open - QString errorMessage; - const QString projectFile = openProject(checkoutPath, &errorMessage); - if (projectFile.isEmpty()) { - QMessageBox msgBox(QMessageBox::Warning, tr("Cannot Open Project"), - tr("Failed to open project in \"%1\".").arg(checkoutPath.toUserOutput())); - msgBox.setDetailedText(errorMessage); - msgBox.addButton(QMessageBox::Ok); - msgBox.exec(); - } -} - -static inline QString msgNoProjectFiles(const QDir &dir, const QStringList &patterns) -{ - return BaseCheckoutWizardFactory::tr("Could not find any project files matching (%1) in the directory \"%2\".").arg(patterns.join(QLatin1String(", ")), QDir::toNativeSeparators(dir.absolutePath())); -} - -// Try to find the project files in a project directory with some smartness -static QFileInfoList findProjectFiles(const QDir &projectDir, QString *errorMessage) -{ - const QStringList projectFilePatterns = ProjectExplorer::ProjectExplorerPlugin::projectFilePatterns(); - // Project directory - QFileInfoList projectFiles = projectDir.entryInfoList(projectFilePatterns, QDir::Files|QDir::NoDotAndDotDot|QDir::Readable); - if (!projectFiles.empty()) - return projectFiles; - // Try a 'src' directory - QFileInfoList srcDirs = projectDir.entryInfoList(QStringList(QLatin1String("src")), QDir::Dirs|QDir::NoDotAndDotDot|QDir::Readable); - if (srcDirs.empty()) { - *errorMessage = msgNoProjectFiles(projectDir, projectFilePatterns); - return QFileInfoList(); - } - const QDir srcDir = QDir(srcDirs.front().absoluteFilePath()); - projectFiles = srcDir.entryInfoList(projectFilePatterns, QDir::Files|QDir::NoDotAndDotDot|QDir::Readable); - if (projectFiles.empty()) { - *errorMessage = msgNoProjectFiles(srcDir, projectFilePatterns); - return QFileInfoList(); - } - return projectFiles; -} - -QString BaseCheckoutWizardFactory::openProject(const Utils::FileName &path, QString *errorMessage) -{ - // Search the directory for project files - const QDir dir(path.toString()); - if (!dir.exists()) { - *errorMessage = tr("\"%1\" does not exist."). - arg(path.toUserOutput()); // Should not happen - return QString(); - } - QFileInfoList projectFiles = findProjectFiles(dir, errorMessage); - if (projectFiles.empty()) - return QString(); - // Open. Do not use a busy cursor here as additional wizards might pop up - const QString projectFile = projectFiles.front().absoluteFilePath(); - if (!ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(projectFile, errorMessage)) - return QString(); - - return projectFile; -} - -void BaseCheckoutWizardFactory::setWizardCreator(const BaseCheckoutWizardFactory::WizardCreator &creator) -{ - m_wizardCreator = creator; -} - -} // namespace VcsBase diff --git a/src/plugins/vcsbase/basecheckoutwizardfactory.h b/src/plugins/vcsbase/basecheckoutwizardfactory.h deleted file mode 100644 index 46dcb74563a..00000000000 --- a/src/plugins/vcsbase/basecheckoutwizardfactory.h +++ /dev/null @@ -1,64 +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 BASECHECKOUTWIZARDFACTORY_H -#define BASECHECKOUTWIZARDFACTORY_H - -#include "vcsbase_global.h" -#include <coreplugin/iwizardfactory.h> - -#include <functional> - -namespace Utils { class FileName; } -namespace VcsBase { -class BaseCheckoutWizard; -class VcsCommand; - -class VCSBASE_EXPORT BaseCheckoutWizardFactory : public Core::IWizardFactory -{ - Q_OBJECT - -public: - BaseCheckoutWizardFactory(); - - void runWizard(const QString &path, QWidget *parent, const QString &platform, const QVariantMap &extraValues); - - static QString openProject(const Utils::FileName &path, QString *errorMessage); - - typedef std::function<BaseCheckoutWizard *(const Utils::FileName &path, QWidget *parent)> WizardCreator; - void setWizardCreator(const WizardCreator &creator); - -private: - WizardCreator m_wizardCreator; -}; - -} // namespace VcsBase - -#endif // BASECHECKOUTWIZARDFACTORY_H diff --git a/src/plugins/vcsbase/basecheckoutwizardpage.cpp b/src/plugins/vcsbase/basecheckoutwizardpage.cpp deleted file mode 100644 index 82e061d6899..00000000000 --- a/src/plugins/vcsbase/basecheckoutwizardpage.cpp +++ /dev/null @@ -1,262 +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 "basecheckoutwizardpage.h" -#include "ui_basecheckoutwizardpage.h" - -#include <QDir> -#include <QIcon> - -/*! - \class VcsBase::BaseCheckoutWizardPage - - \brief The BaseCheckoutWizardPage class is the base class for a parameter - page of a checkout wizard. - - Lets the user specify the repository, a checkout directory and - the path. Contains a virtual to derive the checkout directory - from the repository as it is entered. - - \sa VcsBase::BaseCheckoutWizard -*/ - -namespace VcsBase { -namespace Internal { - -class BaseCheckoutWizardPagePrivate -{ -public: - BaseCheckoutWizardPagePrivate() : m_valid(false), m_directoryEdited(false) {} - - Internal::Ui::BaseCheckoutWizardPage ui; - bool m_valid; - bool m_directoryEdited; -}; - -} // namespace Internal - -BaseCheckoutWizardPage::BaseCheckoutWizardPage(QWidget *parent) : - QWizardPage(parent), - d(new Internal::BaseCheckoutWizardPagePrivate) -{ - d->ui.setupUi(this); - - connect(d->ui.repositoryLineEdit, &QLineEdit::textChanged, - this, &BaseCheckoutWizardPage::slotRepositoryChanged); - - connect(d->ui.checkoutDirectoryLineEdit, &QLineEdit::textChanged, - this, &BaseCheckoutWizardPage::slotChanged); - connect(d->ui.checkoutDirectoryLineEdit, &QLineEdit::textEdited, - this, &BaseCheckoutWizardPage::slotDirectoryEdited); - connect(d->ui.branchComboBox, - static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), - this, &BaseCheckoutWizardPage::slotChanged); - - d->ui.pathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory); - d->ui.pathChooser->setHistoryCompleter(QLatin1String("Vcs.CheckoutDir.History")); - connect(d->ui.pathChooser, &Utils::PathChooser::validChanged, - this, &BaseCheckoutWizardPage::slotChanged); - - d->ui.branchComboBox->setEnabled(false); - d->ui.branchRefreshToolButton->setIcon(QIcon(QLatin1String(":/locator/images/reload.png"))); - connect(d->ui.branchRefreshToolButton, &QAbstractButton::clicked, - this, &BaseCheckoutWizardPage::slotRefreshBranches); -} - -BaseCheckoutWizardPage::~BaseCheckoutWizardPage() -{ - delete d; -} - -void BaseCheckoutWizardPage::addLocalControl(QWidget *w) -{ - d->ui.localLayout->addRow(w); -} - -void BaseCheckoutWizardPage::addLocalControl(QString &description, QWidget *w) -{ - d->ui.localLayout->addRow(description, w); -} - -void BaseCheckoutWizardPage::addRepositoryControl(QWidget *w) -{ - d->ui.repositoryLayout->addRow(w); -} - -bool BaseCheckoutWizardPage::checkIsValid() const -{ - if (!d->ui.pathChooser->isValid() || d->ui.repositoryLineEdit->text().isEmpty()) - return false; - - const QString checkoutDirectory = d->ui.checkoutDirectoryLineEdit->text(); - if (checkoutDirectory.isEmpty()) - return false; - const QDir dir(d->ui.pathChooser->path() + QLatin1Char('/') + checkoutDirectory); - return !dir.exists() || (dir.count() <= 2); -} - -void BaseCheckoutWizardPage::addRepositoryControl(QString &description, QWidget *w) -{ - d->ui.repositoryLayout->addRow(description, w); -} - -bool BaseCheckoutWizardPage::isBranchSelectorVisible() const -{ - return d->ui.branchComboBox->isVisible(); -} - -void BaseCheckoutWizardPage::setBranchSelectorVisible(bool v) -{ - d->ui.branchComboBox->setVisible(v); - d->ui.branchRefreshToolButton->setVisible(v); - d->ui.branchLabel->setVisible(v); -} - -void BaseCheckoutWizardPage::setRepositoryLabel(const QString &l) -{ - d->ui.repositoryLabel->setText(l); -} - -bool BaseCheckoutWizardPage::isRepositoryReadOnly() const -{ - return d->ui.repositoryLineEdit->isReadOnly(); -} - -void BaseCheckoutWizardPage::setRepositoryReadOnly(bool v) -{ - d->ui.repositoryLineEdit->setReadOnly(v); -} - -QString BaseCheckoutWizardPage::path() const -{ - return d->ui.pathChooser->path(); -} - -void BaseCheckoutWizardPage::setPath(const QString &p) -{ - d->ui.pathChooser->setPath(p); -} - -QString BaseCheckoutWizardPage::directory() const -{ - return d->ui.checkoutDirectoryLineEdit->text(); -} - -void BaseCheckoutWizardPage::setDirectory(const QString &dir) -{ - d->ui.checkoutDirectoryLineEdit->setText(dir); -} - -void BaseCheckoutWizardPage::setDirectoryVisible(bool v) -{ - d->ui.checkoutDirectoryLabel->setVisible(v); - d->ui.checkoutDirectoryLineEdit->setVisible(v); -} - -QString BaseCheckoutWizardPage::repository() const -{ - return d->ui.repositoryLineEdit->text().trimmed(); -} - -void BaseCheckoutWizardPage::setRepository(const QString &r) -{ - d->ui.repositoryLineEdit->setText(r); -} - -QString BaseCheckoutWizardPage::branch() const -{ - return d->ui.branchComboBox->currentText(); -} - -void BaseCheckoutWizardPage::setBranch(const QString &b) -{ - const int index = d->ui.branchComboBox->findText(b); - if (index != -1) - d->ui.branchComboBox->setCurrentIndex(index); -} - -void BaseCheckoutWizardPage::slotRefreshBranches() -{ - if (!isBranchSelectorVisible()) - return; - // Refresh branch list on demand. This is hard to make - // automagically since there can be network slowness/timeouts, etc. - int current; - const QStringList branchList = branches(repository(), ¤t); - d->ui.branchComboBox->clear(); - d->ui.branchComboBox->setEnabled(branchList.size() > 1); - if (!branchList.isEmpty()) { - d->ui.branchComboBox->addItems(branchList); - if (current >= 0 && current < branchList.size()) - d->ui.branchComboBox->setCurrentIndex(current); - } - slotChanged(); -} - -void BaseCheckoutWizardPage::slotRepositoryChanged(const QString &repo) -{ - // Derive directory name from repository unless user manually edited it. - if (!d->m_directoryEdited) - d->ui.checkoutDirectoryLineEdit->setText(directoryFromRepository(repo)); - slotChanged(); -} - -QString BaseCheckoutWizardPage::directoryFromRepository(const QString &r) const -{ - return r; -} - -QStringList BaseCheckoutWizardPage::branches(const QString &, int *) -{ - return QStringList(); -} - -void BaseCheckoutWizardPage::slotDirectoryEdited() -{ - d->m_directoryEdited = true; - slotChanged(); -} - -bool BaseCheckoutWizardPage::isComplete() const -{ - return d->m_valid; -} - -void BaseCheckoutWizardPage::slotChanged() -{ - const bool valid = checkIsValid(); - - if (valid != d->m_valid) { - d->m_valid = valid; - emit completeChanged(); - } -} - -} // namespace VcsBase diff --git a/src/plugins/vcsbase/basecheckoutwizardpage.h b/src/plugins/vcsbase/basecheckoutwizardpage.h deleted file mode 100644 index b4074ce7724..00000000000 --- a/src/plugins/vcsbase/basecheckoutwizardpage.h +++ /dev/null @@ -1,110 +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 VCSBASE_CHECKOUTWIZARDPAGE_H -#define VCSBASE_CHECKOUTWIZARDPAGE_H - -#include "vcsbase_global.h" - -#include <QWizardPage> - -namespace VcsBase { - -namespace Internal { -class BaseCheckoutWizardPagePrivate; - -namespace Ui { class BaseCheckoutWizardPage; } -} // namespace Internal - - -class VCSBASE_EXPORT BaseCheckoutWizardPage : public QWizardPage -{ - Q_OBJECT - Q_PROPERTY(bool isBranchSelectorVisible READ isBranchSelectorVisible - WRITE setBranchSelectorVisible) - -public: - BaseCheckoutWizardPage(QWidget *parent = 0); - ~BaseCheckoutWizardPage(); - - QString path() const; - void setPath(const QString &); - - QString directory() const; - void setDirectory(const QString &d); - - QString repository() const; - void setRepository(const QString &r); - - bool isRepositoryReadOnly() const; - void setRepositoryReadOnly(bool v); - - QString branch() const; - void setBranch(const QString &); - - virtual bool isComplete() const; - - bool isBranchSelectorVisible() const; - -protected: - void setRepositoryLabel(const QString &l); - void setDirectoryVisible(bool v); - void setBranchSelectorVisible(bool v); - - // Determine a checkout directory name from - // repository URL, that is, "protocol:/project" -> "project". - virtual QString directoryFromRepository(const QString &r) const; - - // Return list of branches of that repository, defaults to empty. - virtual QStringList branches(const QString &repository, int *current); - - // Add additional controls. - void addLocalControl(QWidget *w); - void addLocalControl(QString &description, QWidget *w); - - void addRepositoryControl(QWidget *w); - void addRepositoryControl(QString &description, QWidget *w); - - // Override validity information. - virtual bool checkIsValid() const; - -private slots: - void slotRepositoryChanged(const QString &url); - void slotDirectoryEdited(); - void slotChanged(); - void slotRefreshBranches(); - -private: - Internal::BaseCheckoutWizardPagePrivate *const d; -}; - -} // namespace VcsBase - -#endif // VCSBASE_CHECKOUTWIZARDPAGE_H diff --git a/src/plugins/vcsbase/basecheckoutwizardpage.ui b/src/plugins/vcsbase/basecheckoutwizardpage.ui deleted file mode 100644 index edf34f080b0..00000000000 --- a/src/plugins/vcsbase/basecheckoutwizardpage.ui +++ /dev/null @@ -1,156 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>VcsBase::Internal::BaseCheckoutWizardPage</class> - <widget class="QWizardPage" name="VcsBase::Internal::BaseCheckoutWizardPage"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>483</width> - <height>237</height> - </rect> - </property> - <property name="windowTitle"> - <string>WizardPage</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QGroupBox" name="repositoryGroupBox"> - <property name="title"> - <string>Repository</string> - </property> - <property name="flat"> - <bool>true</bool> - </property> - <property name="checkable"> - <bool>false</bool> - </property> - <layout class="QFormLayout" name="repositoryLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="repositoryLabel"/> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="repositoryLineEdit"> - <property name="toolTip"> - <string>The remote repository to check out.</string> - </property> - <property name="whatsThis"> - <string/> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="branchLabel"> - <property name="text"> - <string>Branch:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <layout class="QHBoxLayout" name="branchHorizontalLayout"> - <item> - <widget class="QComboBox" name="branchComboBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>The development branch in the remote repository to check out.</string> - </property> - <property name="whatsThis"> - <string/> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="branchRefreshToolButton"> - <property name="toolTip"> - <string>Retrieve list of branches in repository.</string> - </property> - <property name="text"> - <string>...</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="localGroupBox"> - <property name="title"> - <string>Working Copy</string> - </property> - <property name="flat"> - <bool>true</bool> - </property> - <layout class="QFormLayout" name="localLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="pathLabel"> - <property name="toolTip"> - <string>The path in which the directory containing the checkout will be created.</string> - </property> - <property name="text"> - <string>Path:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="Utils::PathChooser" name="pathChooser" native="true"/> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="checkoutDirectoryLabel"> - <property name="toolTip"> - <string>The local directory that will contain the code after the checkout.</string> - </property> - <property name="text"> - <string>Directory:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="checkoutDirectoryLineEdit"> - <property name="toolTip"> - <string>The local directory that will contain the code after the checkout.</string> - </property> - <property name="whatsThis"> - <string/> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>Utils::PathChooser</class> - <extends>QWidget</extends> - <header location="global">utils/pathchooser.h</header> - <container>1</container> - <slots> - <signal>editingFinished()</signal> - <signal>browsingFinished()</signal> - </slots> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/vcsbase/vcsbase.pro b/src/plugins/vcsbase/vcsbase.pro index fb44846f2f1..b433f817433 100644 --- a/src/plugins/vcsbase/vcsbase.pro +++ b/src/plugins/vcsbase/vcsbase.pro @@ -20,9 +20,6 @@ HEADERS += vcsbase_global.h \ commonvcssettings.h \ commonsettingspage.h \ nicknamedialog.h \ - basecheckoutwizardfactory.h \ - basecheckoutwizard.h \ - basecheckoutwizardpage.h \ vcsoutputwindow.h \ cleandialog.h \ vcsbaseoptionspage.h \ @@ -51,9 +48,6 @@ SOURCES += vcsplugin.cpp \ commonvcssettings.cpp \ commonsettingspage.cpp \ nicknamedialog.cpp \ - basecheckoutwizardfactory.cpp \ - basecheckoutwizard.cpp \ - basecheckoutwizardpage.cpp \ vcsoutputwindow.cpp \ cleandialog.cpp \ vcsbaseoptionspage.cpp \ @@ -68,6 +62,5 @@ RESOURCES += vcsbase.qrc FORMS += commonsettingspage.ui \ nicknamedialog.ui \ - basecheckoutwizardpage.ui \ cleandialog.ui \ submiteditorwidget.ui diff --git a/src/plugins/vcsbase/vcsbase.qbs b/src/plugins/vcsbase/vcsbase.qbs index dcc28012a0b..d2782082248 100644 --- a/src/plugins/vcsbase/vcsbase.qbs +++ b/src/plugins/vcsbase/vcsbase.qbs @@ -16,13 +16,6 @@ QtcPlugin { files: [ "baseannotationhighlighter.cpp", "baseannotationhighlighter.h", - "basecheckoutwizard.cpp", - "basecheckoutwizard.h", - "basecheckoutwizardfactory.cpp", - "basecheckoutwizardfactory.h", - "basecheckoutwizardpage.cpp", - "basecheckoutwizardpage.h", - "basecheckoutwizardpage.ui", "basevcseditorfactory.cpp", "basevcseditorfactory.h", "basevcssubmiteditorfactory.cpp", |