forked from qt-creator/qt-creator
Vcs: Add method to create a Wizard to the WizardFactory and use it
Implement it in all VCS that support this type of wizard Change-Id: I78b0e4a37e6bf6b25d8cee4b1e96bcc76188047a Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -52,6 +52,11 @@ CloneWizardFactory::CloneWizardFactory()
|
||||
setDisplayName(tr("Bazaar Clone (Or Branch)"));
|
||||
}
|
||||
|
||||
VcsBase::BaseCheckoutWizard *CloneWizardFactory::create(const QList<QWizardPage *> ¶meterPages, QWidget *parent) const
|
||||
{
|
||||
return new CloneWizard(parameterPages, parent);
|
||||
}
|
||||
|
||||
QList<QWizardPage *> CloneWizardFactory::createParameterPages(const QString &path)
|
||||
{
|
||||
QList<QWizardPage *> wizardPageList;
|
||||
@@ -103,3 +108,11 @@ VcsBase::Command *CloneWizardFactory::createCommand(const QList<QWizardPage *> &
|
||||
command->addJob(args, -1);
|
||||
return command;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CloneWizard:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
CloneWizard::CloneWizard(const QList<QWizardPage *> ¶meterPages, QWidget *parent) :
|
||||
VcsBase::BaseCheckoutWizard(parameterPages, parent)
|
||||
{ }
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define CLONEWIZARD_H
|
||||
|
||||
#include <vcsbase/basecheckoutwizardfactory.h>
|
||||
#include <vcsbase/basecheckoutwizard.h>
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
@@ -44,12 +45,22 @@ class CloneWizardFactory : public VcsBase::BaseCheckoutWizardFactory
|
||||
public:
|
||||
CloneWizardFactory();
|
||||
|
||||
VcsBase::BaseCheckoutWizard *create(const QList<QWizardPage *> ¶meterPages, QWidget *parent = 0) const;
|
||||
|
||||
private:
|
||||
QList<QWizardPage *> createParameterPages(const QString &path);
|
||||
VcsBase::Command *createCommand(const QList<QWizardPage *> ¶meterPages,
|
||||
QString *checkoutPath);
|
||||
};
|
||||
|
||||
class CloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CloneWizard(const QList<QWizardPage *> ¶meterPages, QWidget *parent = 0);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Bazaar
|
||||
|
||||
|
||||
@@ -48,6 +48,11 @@ CheckoutWizardFactory::CheckoutWizardFactory()
|
||||
setDisplayName(tr("CVS Checkout"));
|
||||
}
|
||||
|
||||
VcsBase::BaseCheckoutWizard *CheckoutWizardFactory::create(const QList<QWizardPage *> ¶meterPages, QWidget *parent) const
|
||||
{
|
||||
return new CheckoutWizard(parameterPages, parent);
|
||||
}
|
||||
|
||||
QList<QWizardPage*> CheckoutWizardFactory::createParameterPages(const QString &path)
|
||||
{
|
||||
QList<QWizardPage*> rc;
|
||||
@@ -81,5 +86,13 @@ VcsBase::Command *CheckoutWizardFactory::createCommand(const QList<QWizardPage*>
|
||||
return command;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CheckoutWizard:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
CheckoutWizard::CheckoutWizard(const QList<QWizardPage *> ¶meterPages, QWidget *parent) :
|
||||
VcsBase::BaseCheckoutWizard(parameterPages, parent)
|
||||
{ }
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Cvs
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define CHECKOUTWIZARD_H
|
||||
|
||||
#include <vcsbase/basecheckoutwizardfactory.h>
|
||||
#include <vcsbase/basecheckoutwizard.h>
|
||||
|
||||
namespace Cvs {
|
||||
namespace Internal {
|
||||
@@ -42,6 +43,8 @@ class CheckoutWizardFactory : public VcsBase::BaseCheckoutWizardFactory
|
||||
public:
|
||||
CheckoutWizardFactory();
|
||||
|
||||
VcsBase::BaseCheckoutWizard *create(const QList<QWizardPage *> ¶meterPages, QWidget *parent = 0) const;
|
||||
|
||||
private:
|
||||
// BaseCheckoutWizard
|
||||
QList<QWizardPage*> createParameterPages(const QString &path);
|
||||
@@ -49,6 +52,14 @@ private:
|
||||
QString *checkoutPath);
|
||||
};
|
||||
|
||||
class CheckoutWizard : public VcsBase::BaseCheckoutWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CheckoutWizard(const QList<QWizardPage *> ¶meterPages, QWidget *parent = 0);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Cvs
|
||||
|
||||
|
||||
@@ -49,6 +49,11 @@ CloneWizardFactory::CloneWizardFactory()
|
||||
setDisplayName(tr("Git Repository Clone"));
|
||||
}
|
||||
|
||||
VcsBase::BaseCheckoutWizard *CloneWizardFactory::create(const QList<QWizardPage *> ¶meterPages, QWidget *parent) const
|
||||
{
|
||||
return new CloneWizard(parameterPages, parent);
|
||||
}
|
||||
|
||||
QList<QWizardPage*> CloneWizardFactory::createParameterPages(const QString &path)
|
||||
{
|
||||
QList<QWizardPage*> rc;
|
||||
@@ -76,5 +81,13 @@ VcsBase::Command *CloneWizardFactory::createCommand(const QList<QWizardPage*> &p
|
||||
return cwp->createCheckoutJob(checkoutPath);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CloneWizard:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
CloneWizard::CloneWizard(const QList<QWizardPage *> ¶meterPages, QWidget *parent) :
|
||||
VcsBase::BaseCheckoutWizard(parameterPages, parent)
|
||||
{ }
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Git
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define CLONEWIZARD_H
|
||||
|
||||
#include <vcsbase/basecheckoutwizardfactory.h>
|
||||
#include <vcsbase/basecheckoutwizard.h>
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
@@ -42,6 +43,8 @@ class CloneWizardFactory : public VcsBase::BaseCheckoutWizardFactory
|
||||
public:
|
||||
CloneWizardFactory();
|
||||
|
||||
VcsBase::BaseCheckoutWizard *create(const QList<QWizardPage *> ¶meterPages, QWidget *parent = 0) const;
|
||||
|
||||
private:
|
||||
// BaseCheckoutWizard
|
||||
QList<QWizardPage*> createParameterPages(const QString &path);
|
||||
@@ -49,6 +52,14 @@ private:
|
||||
QString *checkoutPath);
|
||||
};
|
||||
|
||||
class CloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CloneWizard(const QList<QWizardPage *> ¶meterPages, QWidget *parent = 0);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Git
|
||||
|
||||
|
||||
@@ -77,6 +77,11 @@ GitoriousCloneWizardFactory::GitoriousCloneWizardFactory()
|
||||
setDisplayName(tr("Gitorious Repository Clone"));
|
||||
}
|
||||
|
||||
VcsBase::BaseCheckoutWizard *GitoriousCloneWizardFactory::create(const QList<QWizardPage *> ¶meterPages, QWidget *parent) const
|
||||
{
|
||||
return new GitoriousCloneWizard(parameterPages, parent);
|
||||
}
|
||||
|
||||
QList<QWizardPage*> GitoriousCloneWizardFactory::createParameterPages(const QString &path)
|
||||
{
|
||||
QList<QWizardPage*> rc;
|
||||
@@ -102,5 +107,13 @@ VcsBase::Command *GitoriousCloneWizardFactory::createCommand(const QList<QWizard
|
||||
return cwp->createCheckoutJob(checkoutPath);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// GitoriousCloneWizard:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
GitoriousCloneWizard::GitoriousCloneWizard(const QList<QWizardPage *> ¶meterPages, QWidget *parent) :
|
||||
VcsBase::BaseCheckoutWizard(parameterPages, parent)
|
||||
{ }
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Gitorius
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define GITORIOUSCLONEWIZARD_H
|
||||
|
||||
#include <vcsbase/basecheckoutwizardfactory.h>
|
||||
#include <vcsbase/basecheckoutwizard.h>
|
||||
|
||||
namespace Gitorious {
|
||||
namespace Internal {
|
||||
@@ -44,6 +45,8 @@ class GitoriousCloneWizardFactory : public VcsBase::BaseCheckoutWizardFactory
|
||||
public:
|
||||
GitoriousCloneWizardFactory();
|
||||
|
||||
VcsBase::BaseCheckoutWizard *create(const QList<QWizardPage *> ¶meterPages, QWidget *parent = 0) const;
|
||||
|
||||
private:
|
||||
// BaseCheckoutWizard
|
||||
QList<QWizardPage*> createParameterPages(const QString &path);
|
||||
@@ -51,6 +54,15 @@ private:
|
||||
QString *checkoutPath);
|
||||
};
|
||||
|
||||
class GitoriousCloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GitoriousCloneWizard(const QList<QWizardPage *> ¶meterPages, QWidget *parent = 0);
|
||||
};
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Gitorious
|
||||
|
||||
|
||||
@@ -49,6 +49,11 @@ CloneWizardFactory::CloneWizardFactory()
|
||||
setDisplayName(tr("Mercurial Clone"));
|
||||
}
|
||||
|
||||
BaseCheckoutWizard *CloneWizardFactory::create(const QList<QWizardPage *> ¶meterPages, QWidget *parent) const
|
||||
{
|
||||
return new CloneWizard(parameterPages, parent);
|
||||
}
|
||||
|
||||
QList<QWizardPage *> CloneWizardFactory::createParameterPages(const QString &path)
|
||||
{
|
||||
QList<QWizardPage *> wizardPageList;
|
||||
@@ -82,3 +87,11 @@ Command *CloneWizardFactory::createCommand(const QList<QWizardPage *> ¶meter
|
||||
command->addJob(args, -1);
|
||||
return command;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CloneWizard:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
CloneWizard::CloneWizard(const QList<QWizardPage *> ¶meterPages, QWidget *parent) :
|
||||
VcsBase::BaseCheckoutWizard(parameterPages, parent)
|
||||
{ }
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define CLONEWIZARD_H
|
||||
|
||||
#include <vcsbase/basecheckoutwizardfactory.h>
|
||||
#include <vcsbase/basecheckoutwizard.h>
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
@@ -44,6 +45,8 @@ class CloneWizardFactory : public VcsBase::BaseCheckoutWizardFactory
|
||||
public:
|
||||
CloneWizardFactory();
|
||||
|
||||
VcsBase::BaseCheckoutWizard *create(const QList<QWizardPage *> ¶meterPages, QWidget *parent = 0) const;
|
||||
|
||||
protected:
|
||||
QList<QWizardPage *> createParameterPages(const QString &path);
|
||||
VcsBase::Command *createCommand(const QList<QWizardPage *> ¶meterPages,
|
||||
@@ -53,6 +56,14 @@ private:
|
||||
const QIcon m_icon;
|
||||
};
|
||||
|
||||
class CloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CloneWizard(const QList<QWizardPage *> ¶meterPages, QWidget *parent = 0);
|
||||
};
|
||||
|
||||
} //namespace Internal
|
||||
} //namespace Mercurial
|
||||
|
||||
|
||||
@@ -87,5 +87,13 @@ VcsBase::Command *CheckoutWizardFactory::createCommand(const QList<QWizardPage*>
|
||||
return command;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CheckoutWizard:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
CheckoutWizard::CheckoutWizard(const QList<QWizardPage *> ¶meterPages, QWidget *parent) :
|
||||
VcsBase::BaseCheckoutWizard(parameterPages, parent)
|
||||
{ }
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Subversion
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define CHECKOUTWIZARD_H
|
||||
|
||||
#include <vcsbase/basecheckoutwizardfactory.h>
|
||||
#include <vcsbase/basecheckoutwizard.h>
|
||||
|
||||
namespace Subversion {
|
||||
namespace Internal {
|
||||
@@ -42,6 +43,8 @@ class CheckoutWizardFactory : public VcsBase::BaseCheckoutWizardFactory
|
||||
public:
|
||||
CheckoutWizardFactory();
|
||||
|
||||
VcsBase::BaseCheckoutWizard *create(const QList<QWizardPage *> ¶meterPages, QWidget *parent = 0) const;
|
||||
|
||||
private:
|
||||
// BaseCheckoutWizard
|
||||
QList<QWizardPage*> createParameterPages(const QString &path);
|
||||
@@ -49,6 +52,14 @@ private:
|
||||
QString *checkoutPath);
|
||||
};
|
||||
|
||||
class CheckoutWizard : public VcsBase::BaseCheckoutWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CheckoutWizard(const QList<QWizardPage *> ¶meterPages, QWidget *parent = 0);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Subversion
|
||||
|
||||
|
||||
@@ -45,8 +45,7 @@ class VCSBASE_EXPORT BaseCheckoutWizard : public Utils::Wizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BaseCheckoutWizard(const QList<QWizardPage *> ¶meterPages,
|
||||
QWidget *parent = 0);
|
||||
explicit BaseCheckoutWizard(const QList<QWizardPage *> ¶meterPages, QWidget *parent = 0);
|
||||
|
||||
void setTitle(const QString &title);
|
||||
void setStartedStatus(const QString &title);
|
||||
|
||||
@@ -78,6 +78,7 @@ public:
|
||||
void BaseCheckoutWizardFactoryPrivate::clear()
|
||||
{
|
||||
parameterPages.clear();
|
||||
delete wizard;
|
||||
wizard = 0;
|
||||
checkoutPath.clear();
|
||||
}
|
||||
@@ -107,15 +108,15 @@ void BaseCheckoutWizardFactory::runWizard(const QString &path, QWidget *parent,
|
||||
// Create dialog and launch
|
||||
|
||||
d->parameterPages = createParameterPages(path);
|
||||
BaseCheckoutWizard wizard(d->parameterPages, parent);
|
||||
BaseCheckoutWizard *wizard = create(d->parameterPages, parent);
|
||||
if (!d->progressTitle.isEmpty())
|
||||
wizard.setTitle(d->progressTitle);
|
||||
wizard->setTitle(d->progressTitle);
|
||||
if (!d->startedStatus.isEmpty())
|
||||
wizard.setStartedStatus(d->startedStatus);
|
||||
d->wizard = &wizard;
|
||||
connect(&wizard, SIGNAL(progressPageShown()), this, SLOT(slotProgressPageShown()));
|
||||
wizard.setWindowTitle(displayName());
|
||||
if (wizard.exec() != QDialog::Accepted)
|
||||
wizard->setStartedStatus(d->startedStatus);
|
||||
d->wizard = wizard;
|
||||
connect(wizard, SIGNAL(progressPageShown()), this, SLOT(slotProgressPageShown()));
|
||||
wizard->setWindowTitle(displayName());
|
||||
if (wizard->exec() != QDialog::Accepted)
|
||||
return;
|
||||
// Now try to find the project file and open
|
||||
const QString checkoutPath = d->checkoutPath;
|
||||
|
||||
@@ -43,6 +43,7 @@ QT_END_NAMESPACE
|
||||
namespace VcsBase {
|
||||
namespace Internal { class BaseCheckoutWizardFactoryPrivate; }
|
||||
|
||||
class BaseCheckoutWizard;
|
||||
class Command;
|
||||
|
||||
class VCSBASE_EXPORT BaseCheckoutWizardFactory : public Core::IWizardFactory
|
||||
@@ -57,6 +58,8 @@ public:
|
||||
|
||||
static QString openProject(const QString &path, QString *errorMessage);
|
||||
|
||||
virtual BaseCheckoutWizard *create(const QList<QWizardPage *> ¶meterPages, QWidget *parent = 0) const = 0;
|
||||
|
||||
protected:
|
||||
void setCustomLabels(const QString &progressTitle, const QString &startedStatus);
|
||||
virtual QList<QWizardPage *> createParameterPages(const QString &path) = 0;
|
||||
|
||||
Reference in New Issue
Block a user