diff --git a/src/plugins/cvs/checkoutwizard.cpp b/src/plugins/cvs/checkoutwizard.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7e7eb026b24651fc334548db2802488c47cd1f21 --- /dev/null +++ b/src/plugins/cvs/checkoutwizard.cpp @@ -0,0 +1,89 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#include "checkoutwizard.h" +#include "checkoutwizardpage.h" +#include "cvsplugin.h" + +#include <vcsbase/checkoutjobs.h> +#include <utils/qtcassert.h> + +#include <QtGui/QIcon> + +namespace CVS { +namespace Internal { + +CheckoutWizard::CheckoutWizard(QObject *parent) : + VCSBase::BaseCheckoutWizard(parent) +{ +} + +QIcon CheckoutWizard::icon() const +{ + return QIcon(); +} + +QString CheckoutWizard::description() const +{ + return tr("Check-out a project from a CVS repository."); +} + +QString CheckoutWizard::name() const +{ + return tr("CVS Checkout"); +} + +QWizardPage *CheckoutWizard::createParameterPage(const QString &path) +{ + CheckoutWizardPage *cwp = new CheckoutWizardPage; + cwp->setPath(path); + return cwp; +} + +QSharedPointer<VCSBase::AbstractCheckoutJob> CheckoutWizard::createJob(const QWizardPage *parameterPage, + QString *checkoutPath) +{ + // Collect parameters for the checkout command. + // CVS does not allow for checking out into a different directory. + const CheckoutWizardPage *cwp = qobject_cast<const CheckoutWizardPage *>(parameterPage); + QTC_ASSERT(cwp, return QSharedPointer<VCSBase::AbstractCheckoutJob>()) + const CVSSettings settings = CVSPlugin::cvsPluginInstance()->settings(); + const QString binary = settings.cvsCommand; + QStringList args; + const QString repository = cwp->repository(); + args << QLatin1String("checkout") << repository; + const QString workingDirectory = cwp->path(); + *checkoutPath = workingDirectory + QLatin1Char('/') + repository; + VCSBase::AbstractCheckoutJob *job = new VCSBase::ProcessCheckoutJob(binary, settings.addOptions(args), + workingDirectory); + return QSharedPointer<VCSBase::AbstractCheckoutJob>(job); +} + +} // namespace Internal +} // namespace CVS diff --git a/src/plugins/cvs/checkoutwizard.h b/src/plugins/cvs/checkoutwizard.h new file mode 100644 index 0000000000000000000000000000000000000000..53c7f86a96117ea367ab01c707bc8c56a4ab432a --- /dev/null +++ b/src/plugins/cvs/checkoutwizard.h @@ -0,0 +1,58 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#ifndef CHECKOUTWIZARD_H +#define CHECKOUTWIZARD_H + +#include <vcsbase/basecheckoutwizard.h> + +namespace CVS { +namespace Internal { + +class CheckoutWizard : public VCSBase::BaseCheckoutWizard +{ +public: + explicit CheckoutWizard(QObject *parent = 0); + + // IWizard + virtual QIcon icon() const; + virtual QString description() const; + virtual QString name() const; + +protected: + // BaseCheckoutWizard + virtual QWizardPage *createParameterPage(const QString &path); + virtual QSharedPointer<VCSBase::AbstractCheckoutJob> createJob(const QWizardPage *parameterPage, + QString *checkoutPath); +}; + +} // namespace Internal +} // namespace CVS + +#endif // CHECKOUTWIZARD_H diff --git a/src/plugins/cvs/checkoutwizardpage.cpp b/src/plugins/cvs/checkoutwizardpage.cpp new file mode 100644 index 0000000000000000000000000000000000000000..70c97a721aa1e368e2b013e6a70c7de1f779bc4d --- /dev/null +++ b/src/plugins/cvs/checkoutwizardpage.cpp @@ -0,0 +1,44 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#include "checkoutwizardpage.h" + +namespace CVS { +namespace Internal { + +CheckoutWizardPage::CheckoutWizardPage(QWidget *parent) : + VCSBase::BaseCheckoutWizardPage(parent) +{ + setSubTitle(tr("Specify repository and path.")); + setRepositoryLabel(tr("Repository:")); + setDirectoryVisible(false); +} + +} // namespace Internal +} // namespace CVS diff --git a/src/plugins/cvs/checkoutwizardpage.h b/src/plugins/cvs/checkoutwizardpage.h new file mode 100644 index 0000000000000000000000000000000000000000..cfab3a30403ae15f2f9e3dc58ca33419e7d50f7a --- /dev/null +++ b/src/plugins/cvs/checkoutwizardpage.h @@ -0,0 +1,46 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#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 diff --git a/src/plugins/cvs/cvs.pro b/src/plugins/cvs/cvs.pro index 86244a20aacf31464bd93eb4c95344689c44f5ec..a0d6f04602cdaa079bb178cee957c1b1b6912844 100644 --- a/src/plugins/cvs/cvs.pro +++ b/src/plugins/cvs/cvs.pro @@ -17,7 +17,9 @@ HEADERS += annotationhighlighter.h \ cvssubmiteditor.h \ cvssettings.h \ cvsutils.h \ - cvsconstants.h + cvsconstants.h \ + checkoutwizard.h \ + checkoutwizardpage.h SOURCES += annotationhighlighter.cpp \ cvsplugin.cpp \ @@ -27,7 +29,9 @@ SOURCES += annotationhighlighter.cpp \ cvseditor.cpp \ cvssubmiteditor.cpp \ cvssettings.cpp \ - cvsutils.cpp + cvsutils.cpp \ + checkoutwizard.cpp \ + checkoutwizardpage.cpp FORMS += settingspage.ui diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index 85b08656c86fa45cc38e205f5edd4e43c443e27e..83d10fe004f9dd294a720103524dba093765c3cd 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -34,6 +34,7 @@ #include "cvssubmiteditor.h" #include "cvsconstants.h" #include "cvscontrol.h" +#include "checkoutwizard.h" #include <vcsbase/basevcseditorfactory.h> #include <vcsbase/vcsbaseeditor.h> @@ -241,6 +242,8 @@ bool CVSPlugin::initialize(const QStringList &arguments, QString *errorMessage) m_cvsOutputWindow = new CVSOutputWindow(this); addAutoReleasedObject(m_cvsOutputWindow); + addAutoReleasedObject(new CheckoutWizard); + //register actions Core::ActionManager *ami = core->actionManager(); Core::ActionContainer *toolsContainer = ami->actionContainer(M_TOOLS); diff --git a/src/plugins/cvs/cvssettings.h b/src/plugins/cvs/cvssettings.h index ff37307f2bb62224045d159be9dbf230d17a8e93..b6822674ffa89c0542fc7819b0337fe3380a5f07 100644 --- a/src/plugins/cvs/cvssettings.h +++ b/src/plugins/cvs/cvssettings.h @@ -39,7 +39,6 @@ QT_END_NAMESPACE namespace CVS { namespace Internal { -// Todo: Add user name and password? struct CVSSettings { CVSSettings(); diff --git a/src/plugins/git/clonewizard.cpp b/src/plugins/git/clonewizard.cpp index 252534ec4beaacb2d35006d34bf309aedc6799f0..80d3112504d3b608142e43558485b4fbad35056a 100644 --- a/src/plugins/git/clonewizard.cpp +++ b/src/plugins/git/clonewizard.cpp @@ -57,7 +57,7 @@ QString CloneWizard::description() const QString CloneWizard::name() const { - return tr("Git Checkout"); + return tr("Git Repository Clone"); } QWizardPage *CloneWizard::createParameterPage(const QString &path) diff --git a/src/plugins/vcsbase/basecheckoutwizardpage.cpp b/src/plugins/vcsbase/basecheckoutwizardpage.cpp index 565da4052eabbedf5713f881a0c2a361ed569e67..f9fdb1a69774d3ee328a1cfa36d53cac284779a7 100644 --- a/src/plugins/vcsbase/basecheckoutwizardpage.cpp +++ b/src/plugins/vcsbase/basecheckoutwizardpage.cpp @@ -83,6 +83,12 @@ 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(); @@ -95,13 +101,16 @@ void BaseCheckoutWizardPage::setRepository(const QString &r) void BaseCheckoutWizardPage::slotRepositoryChanged(const QString &repo) { - /* Try to figure out a good directory name from something like: - * "svn://<server>/path1/project" -> project */ if (d->m_directoryEdited) return; d->ui.checkoutDirectoryLineEdit->setText(directoryFromRepository(repo)); } +QString BaseCheckoutWizardPage::directoryFromRepository(const QString &r) const +{ + return r; +} + void BaseCheckoutWizardPage::slotDirectoryEdited() { d->m_directoryEdited = true; diff --git a/src/plugins/vcsbase/basecheckoutwizardpage.h b/src/plugins/vcsbase/basecheckoutwizardpage.h index 2130c1944b0c342354773c2e0cce84b88ae1a045..adf5d60dccc23548517dfabb30fb2a1c57d0cab5 100644 --- a/src/plugins/vcsbase/basecheckoutwizardpage.h +++ b/src/plugins/vcsbase/basecheckoutwizardpage.h @@ -68,10 +68,11 @@ protected: void changeEvent(QEvent *e); void setRepositoryLabel(const QString &l); + void setDirectoryVisible(bool v); /* Determine a checkout directory name from * repository URL, that is, "protocol:/project" -> "project". */ - virtual QString directoryFromRepository(const QString &r) const = 0; + virtual QString directoryFromRepository(const QString &r) const; private slots: void slotRepositoryChanged(const QString &url); diff --git a/src/plugins/vcsbase/checkoutjobs.cpp b/src/plugins/vcsbase/checkoutjobs.cpp index 1c19bfe7b3d4202cfcd22c303eececfb69c0230c..b3fe91e95f213b3922beaeecdad3379f26129839 100644 --- a/src/plugins/vcsbase/checkoutjobs.cpp +++ b/src/plugins/vcsbase/checkoutjobs.cpp @@ -87,7 +87,8 @@ ProcessCheckoutJob::~ProcessCheckoutJob() void ProcessCheckoutJob::slotOutput() { - const QString s = QString::fromLocal8Bit(d->process.readAllStandardOutput()); + const QByteArray data = d->process.readAllStandardOutput(); + const QString s = QString::fromLocal8Bit(data, data.endsWith('\n') ? data.size() - 1: data.size()); if (debug) qDebug() << s; emit output(s);