forked from qt-creator/qt-creator
BaseCheckoutWizard*: Move createCommand from factory into Wizard
Change-Id: I0dcc931f279b59f0d6cf7afb553a2fed30baae7a Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -76,7 +76,7 @@ protected:
|
||||
StatusItem parseStatusLine(const QString &line) const;
|
||||
|
||||
private:
|
||||
friend class CloneWizardFactory;
|
||||
friend class CloneWizard;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -56,22 +56,39 @@ VcsBase::BaseCheckoutWizard *CloneWizardFactory::create(const QString &path, QWi
|
||||
return new CloneWizard(path, parent);
|
||||
}
|
||||
|
||||
VcsBase::Command *CloneWizardFactory::createCommand(const QList<QWizardPage *> ¶meterPages,
|
||||
QString *checkoutPath)
|
||||
// --------------------------------------------------------------------
|
||||
// CloneWizard:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
CloneWizard::CloneWizard(const QString &path, QWidget *parent) :
|
||||
VcsBase::BaseCheckoutWizard(path, parent)
|
||||
{
|
||||
const CloneWizardPage *page = 0;
|
||||
foreach (QWizardPage *p, parameterPages) {
|
||||
if ((page = qobject_cast<const CloneWizardPage *>(p)))
|
||||
setTitle(tr("Cloning"));
|
||||
setStartedStatus(tr("Cloning started..."));
|
||||
|
||||
const Core::IVersionControl *vc = BazaarPlugin::instance()->versionControl();
|
||||
if (!vc->isConfigured())
|
||||
addPage(new VcsBase::VcsConfigurationPage(vc));
|
||||
CloneWizardPage *page = new CloneWizardPage;
|
||||
page->setPath(path);
|
||||
addPage(page);
|
||||
}
|
||||
|
||||
VcsBase::Command *CloneWizard::createCommand(QString *checkoutDir)
|
||||
{
|
||||
const CloneWizardPage *cwp = 0;
|
||||
foreach (int pageId, pageIds()) {
|
||||
if ((cwp = qobject_cast<const CloneWizardPage *>(page(pageId))))
|
||||
break;
|
||||
}
|
||||
|
||||
if (!page)
|
||||
if (!cwp)
|
||||
return 0;
|
||||
|
||||
const BazaarSettings &settings = BazaarPlugin::instance()->settings();
|
||||
*checkoutPath = page->path() + QLatin1Char('/') + page->directory();
|
||||
*checkoutDir = cwp->path() + QLatin1Char('/') + cwp->directory();
|
||||
|
||||
const CloneOptionsPanel *panel = page->cloneOptionsPanel();
|
||||
const CloneOptionsPanel *panel = cwp->cloneOptionsPanel();
|
||||
QStringList extraOptions;
|
||||
if (panel->isUseExistingDirectoryOptionEnabled())
|
||||
extraOptions += QLatin1String("--use-existing-dir");
|
||||
@@ -92,28 +109,10 @@ VcsBase::Command *CloneWizardFactory::createCommand(const QList<QWizardPage *> &
|
||||
const BazaarClient *client = BazaarPlugin::instance()->client();
|
||||
QStringList args;
|
||||
args << client->vcsCommandString(BazaarClient::CloneCommand)
|
||||
<< extraOptions << page->repository() << page->directory();
|
||||
<< extraOptions << cwp->repository() << cwp->directory();
|
||||
|
||||
VcsBase::Command *command = new VcsBase::Command(settings.binaryPath(), page->path(),
|
||||
VcsBase::Command *command = new VcsBase::Command(settings.binaryPath(), cwp->path(),
|
||||
client->processEnvironment());
|
||||
command->addJob(args, -1);
|
||||
return command;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CloneWizard:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
CloneWizard::CloneWizard(const QString &path, QWidget *parent) :
|
||||
VcsBase::BaseCheckoutWizard(path, parent)
|
||||
{
|
||||
setTitle(tr("Cloning"));
|
||||
setStartedStatus(tr("Cloning started..."));
|
||||
|
||||
const Core::IVersionControl *vc = BazaarPlugin::instance()->versionControl();
|
||||
if (!vc->isConfigured())
|
||||
addPage(new VcsBase::VcsConfigurationPage(vc));
|
||||
CloneWizardPage *page = new CloneWizardPage;
|
||||
page->setPath(path);
|
||||
addPage(page);
|
||||
}
|
||||
|
||||
@@ -46,10 +46,6 @@ public:
|
||||
CloneWizardFactory();
|
||||
|
||||
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
|
||||
|
||||
private:
|
||||
VcsBase::Command *createCommand(const QList<QWizardPage *> ¶meterPages,
|
||||
QString *checkoutPath);
|
||||
};
|
||||
|
||||
class CloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
@@ -58,6 +54,9 @@ class CloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
|
||||
public:
|
||||
CloneWizard(const QString &path, QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
VcsBase::Command *createCommand(QString *checkoutDir);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -53,31 +53,6 @@ VcsBase::BaseCheckoutWizard *CheckoutWizardFactory::create(const QString &path,
|
||||
return new CheckoutWizard(path, parent);
|
||||
}
|
||||
|
||||
VcsBase::Command *CheckoutWizardFactory::createCommand(const QList<QWizardPage*> ¶meterPages,
|
||||
QString *checkoutPath)
|
||||
{
|
||||
// Collect parameters for the checkout command.
|
||||
// CVS does not allow for checking out into a different directory.
|
||||
const CheckoutWizardPage *cwp = 0;
|
||||
foreach (QWizardPage *p, parameterPages) {
|
||||
if ((cwp = qobject_cast<const CheckoutWizardPage *>(p)))
|
||||
break;
|
||||
}
|
||||
QTC_ASSERT(cwp, return 0);
|
||||
const CvsSettings settings = CvsPlugin::instance()->settings();
|
||||
const QString binary = settings.binaryPath();
|
||||
QStringList args;
|
||||
const QString repository = cwp->repository();
|
||||
args << QLatin1String("checkout") << repository;
|
||||
const QString workingDirectory = cwp->path();
|
||||
*checkoutPath = workingDirectory + QLatin1Char('/') + repository;
|
||||
|
||||
VcsBase::Command *command = new VcsBase::Command(binary, workingDirectory,
|
||||
QProcessEnvironment::systemEnvironment());
|
||||
command->addJob(settings.addOptions(args), -1);
|
||||
return command;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CheckoutWizard:
|
||||
// --------------------------------------------------------------------
|
||||
@@ -93,5 +68,31 @@ CheckoutWizard::CheckoutWizard(const QString &path, QWidget *parent) :
|
||||
addPage(cwp);
|
||||
}
|
||||
|
||||
VcsBase::Command *CheckoutWizard::createCommand(QString *checkoutDir)
|
||||
{
|
||||
// Collect parameters for the checkout command.
|
||||
// CVS does not allow for checking out into a different directory.
|
||||
const CheckoutWizardPage *cwp = 0;
|
||||
foreach (int pageId, pageIds()) {
|
||||
if ((cwp = qobject_cast<const CheckoutWizardPage *>(page(pageId))))
|
||||
break;
|
||||
}
|
||||
|
||||
QTC_ASSERT(cwp, return 0);
|
||||
const CvsSettings settings = CvsPlugin::instance()->settings();
|
||||
const QString binary = settings.binaryPath();
|
||||
QStringList args;
|
||||
|
||||
const QString repository = cwp->repository();
|
||||
args << QLatin1String("checkout") << repository;
|
||||
const QString workingDirectory = cwp->path();
|
||||
*checkoutDir = workingDirectory + QLatin1Char('/') + repository;
|
||||
|
||||
VcsBase::Command *command = new VcsBase::Command(binary, workingDirectory,
|
||||
QProcessEnvironment::systemEnvironment());
|
||||
command->addJob(settings.addOptions(args), -1);
|
||||
return command;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Cvs
|
||||
|
||||
@@ -44,11 +44,6 @@ public:
|
||||
CheckoutWizardFactory();
|
||||
|
||||
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
|
||||
|
||||
private:
|
||||
// BaseCheckoutWizard
|
||||
VcsBase::Command *createCommand(const QList<QWizardPage*> ¶meterPage,
|
||||
QString *checkoutPath);
|
||||
};
|
||||
|
||||
class CheckoutWizard : public VcsBase::BaseCheckoutWizard
|
||||
@@ -57,6 +52,9 @@ class CheckoutWizard : public VcsBase::BaseCheckoutWizard
|
||||
|
||||
public:
|
||||
CheckoutWizard(const QString &path, QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
VcsBase::Command *createCommand(QString *checkoutDir);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -53,20 +53,6 @@ VcsBase::BaseCheckoutWizard *CloneWizardFactory::create(const QString &path, QWi
|
||||
return new CloneWizard(path, parent);
|
||||
}
|
||||
|
||||
VcsBase::Command *CloneWizardFactory::createCommand(const QList<QWizardPage*> ¶meterPages,
|
||||
QString *checkoutPath)
|
||||
{
|
||||
// Collect parameters for the clone command.
|
||||
const CloneWizardPage *cwp = 0;
|
||||
foreach (QWizardPage *wp, parameterPages) {
|
||||
if ((cwp = qobject_cast<const CloneWizardPage *>(wp)))
|
||||
break;
|
||||
}
|
||||
|
||||
QTC_ASSERT(cwp, return 0);
|
||||
return cwp->createCheckoutJob(checkoutPath);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CloneWizard:
|
||||
// --------------------------------------------------------------------
|
||||
@@ -85,5 +71,18 @@ CloneWizard::CloneWizard(const QString &path, QWidget *parent) :
|
||||
addPage(cwp);
|
||||
}
|
||||
|
||||
VcsBase::Command *CloneWizard::createCommand(QString *checkoutDir)
|
||||
{
|
||||
// Collect parameters for the clone command.
|
||||
const CloneWizardPage *cwp = 0;
|
||||
foreach (int pageId, pageIds()) {
|
||||
if ((cwp = qobject_cast<const CloneWizardPage *>(page(pageId))))
|
||||
break;
|
||||
}
|
||||
|
||||
QTC_ASSERT(cwp, return 0);
|
||||
return cwp->createCheckoutJob(checkoutDir);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Git
|
||||
|
||||
@@ -44,11 +44,6 @@ public:
|
||||
CloneWizardFactory();
|
||||
|
||||
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
|
||||
|
||||
private:
|
||||
// BaseCheckoutWizard
|
||||
VcsBase::Command *createCommand(const QList<QWizardPage*> ¶meterPages,
|
||||
QString *checkoutPath);
|
||||
};
|
||||
|
||||
class CloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
@@ -57,6 +52,9 @@ class CloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
|
||||
public:
|
||||
CloneWizard(const QString &path, QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
VcsBase::Command *createCommand(QString *checkoutDir);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -82,18 +82,6 @@ VcsBase::BaseCheckoutWizard *GitoriousCloneWizardFactory::create(const QString &
|
||||
return new GitoriousCloneWizard(path, parent);
|
||||
}
|
||||
|
||||
VcsBase::Command *GitoriousCloneWizardFactory::createCommand(const QList<QWizardPage*> ¶meterPages,
|
||||
QString *checkoutPath)
|
||||
{
|
||||
const Git::CloneWizardPage *cwp = 0;
|
||||
foreach (QWizardPage *p, parameterPages) {
|
||||
if ((cwp = qobject_cast<const Git::CloneWizardPage *>(p)))
|
||||
break;
|
||||
}
|
||||
QTC_ASSERT(cwp, return 0);
|
||||
return cwp->createCheckoutJob(checkoutPath);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// GitoriousCloneWizard:
|
||||
// --------------------------------------------------------------------
|
||||
@@ -120,5 +108,16 @@ GitoriousCloneWizard::GitoriousCloneWizard(const QString &path, QWidget *parent)
|
||||
addPage(clonePage);
|
||||
}
|
||||
|
||||
VcsBase::Command *GitoriousCloneWizard::createCommand(QString *checkoutDir)
|
||||
{
|
||||
const Git::CloneWizardPage *cwp = 0;
|
||||
foreach (int pageId, pageIds()) {
|
||||
if ((cwp = qobject_cast<const Git::CloneWizardPage *>(page(pageId))))
|
||||
break;
|
||||
}
|
||||
QTC_ASSERT(cwp, return 0);
|
||||
return cwp->createCheckoutJob(checkoutDir);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Gitorius
|
||||
|
||||
@@ -46,11 +46,6 @@ public:
|
||||
GitoriousCloneWizardFactory();
|
||||
|
||||
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
|
||||
|
||||
private:
|
||||
// BaseCheckoutWizard
|
||||
VcsBase::Command *createCommand(const QList<QWizardPage*> ¶meterPages,
|
||||
QString *checkoutPath);
|
||||
};
|
||||
|
||||
class GitoriousCloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
@@ -59,6 +54,9 @@ class GitoriousCloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
|
||||
public:
|
||||
GitoriousCloneWizard(const QString &path, QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
VcsBase::Command *createCommand(QString *checkoutDir);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -53,32 +53,6 @@ BaseCheckoutWizard *CloneWizardFactory::create(const QString &path, QWidget *par
|
||||
return new CloneWizard(path, parent);
|
||||
}
|
||||
|
||||
Command *CloneWizardFactory::createCommand(const QList<QWizardPage *> ¶meterPages,
|
||||
QString *checkoutPath)
|
||||
{
|
||||
const CloneWizardPage *page = 0;
|
||||
foreach (QWizardPage *p, parameterPages) {
|
||||
if ((page = qobject_cast<const CloneWizardPage *>(p)))
|
||||
break;
|
||||
}
|
||||
|
||||
if (!page)
|
||||
return 0;
|
||||
|
||||
const MercurialSettings &settings = MercurialPlugin::settings();
|
||||
|
||||
QString path = page->path();
|
||||
QString directory = page->directory();
|
||||
|
||||
QStringList args;
|
||||
args << QLatin1String("clone") << page->repository() << directory;
|
||||
*checkoutPath = path + QLatin1Char('/') + directory;
|
||||
VcsBase::Command *command = new VcsBase::Command(settings.binaryPath(), path,
|
||||
QProcessEnvironment::systemEnvironment());
|
||||
command->addJob(args, -1);
|
||||
return command;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CloneWizard:
|
||||
// --------------------------------------------------------------------
|
||||
@@ -96,3 +70,28 @@ CloneWizard::CloneWizard(const QString &path, QWidget *parent) :
|
||||
page->setPath(path);
|
||||
addPage(page);
|
||||
}
|
||||
|
||||
Command *CloneWizard::createCommand(QString *checkoutDir)
|
||||
{
|
||||
const CloneWizardPage *cwp = 0;
|
||||
foreach (int pageId, pageIds()) {
|
||||
if ((cwp = qobject_cast<const CloneWizardPage *>(page(pageId))))
|
||||
break;
|
||||
}
|
||||
|
||||
if (!cwp)
|
||||
return 0;
|
||||
|
||||
const MercurialSettings &settings = MercurialPlugin::settings();
|
||||
|
||||
QString path = cwp->path();
|
||||
QString directory = cwp->directory();
|
||||
|
||||
QStringList args;
|
||||
args << QLatin1String("clone") << cwp->repository() << directory;
|
||||
*checkoutDir = path + QLatin1Char('/') + directory;
|
||||
VcsBase::Command *command = new VcsBase::Command(settings.binaryPath(), path,
|
||||
QProcessEnvironment::systemEnvironment());
|
||||
command->addJob(args, -1);
|
||||
return command;
|
||||
}
|
||||
|
||||
@@ -47,10 +47,6 @@ public:
|
||||
|
||||
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
|
||||
|
||||
protected:
|
||||
VcsBase::Command *createCommand(const QList<QWizardPage *> ¶meterPages,
|
||||
QString *checkoutPath);
|
||||
|
||||
private:
|
||||
const QIcon m_icon;
|
||||
};
|
||||
@@ -61,6 +57,9 @@ class CloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
|
||||
public:
|
||||
CloneWizard(const QString &path, QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
VcsBase::Command *createCommand(QString *checkoutDir);
|
||||
};
|
||||
|
||||
} //namespace Internal
|
||||
|
||||
@@ -56,34 +56,6 @@ VcsBase::BaseCheckoutWizard *CheckoutWizardFactory::create(const QString &path,
|
||||
return new CheckoutWizard(path, parent);
|
||||
}
|
||||
|
||||
VcsBase::Command *CheckoutWizardFactory::createCommand(const QList<QWizardPage*> ¶meterPages,
|
||||
QString *checkoutPath)
|
||||
{
|
||||
// Collect parameters for the checkout command.
|
||||
const CheckoutWizardPage *cwp = 0;
|
||||
foreach (const QWizardPage *p, parameterPages) {
|
||||
if ((cwp = qobject_cast<const CheckoutWizardPage *>(p)))
|
||||
break;
|
||||
}
|
||||
QTC_ASSERT(cwp, return 0);
|
||||
const SubversionSettings settings = SubversionPlugin::instance()->settings();
|
||||
const QString binary = settings.binaryPath();
|
||||
const QString directory = cwp->directory();
|
||||
QStringList args;
|
||||
args << QLatin1String("checkout") << cwp->repository() << directory;
|
||||
const QString workingDirectory = cwp->path();
|
||||
*checkoutPath = workingDirectory + QLatin1Char('/') + directory;
|
||||
if (settings.hasAuthentication()) {
|
||||
const QString user = settings.stringValue(SubversionSettings::userKey);
|
||||
const QString pwd = settings.stringValue(SubversionSettings::passwordKey);
|
||||
args = SubversionClient::addAuthenticationOptions(args, user, pwd);
|
||||
}
|
||||
VcsBase::Command *command = new VcsBase::Command(binary, workingDirectory,
|
||||
QProcessEnvironment::systemEnvironment());
|
||||
command->addJob(args, -1);
|
||||
return command;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CheckoutWizard:
|
||||
// --------------------------------------------------------------------
|
||||
@@ -99,5 +71,35 @@ CheckoutWizard::CheckoutWizard(const QString &path, QWidget *parent) :
|
||||
addPage(cwp);
|
||||
}
|
||||
|
||||
VcsBase::Command *CheckoutWizard::createCommand(QString *checkoutDir)
|
||||
{
|
||||
// Collect parameters for the checkout command.
|
||||
const CheckoutWizardPage *cwp = 0;
|
||||
foreach (int pageId, pageIds()) {
|
||||
if ((cwp = qobject_cast<const CheckoutWizardPage *>(page(pageId))))
|
||||
break;
|
||||
}
|
||||
QTC_ASSERT(cwp, return 0);
|
||||
|
||||
const SubversionSettings settings = SubversionPlugin::instance()->settings();
|
||||
const QString binary = settings.binaryPath();
|
||||
const QString directory = cwp->directory();
|
||||
QStringList args;
|
||||
args << QLatin1String("checkout") << cwp->repository() << directory;
|
||||
const QString workingDirectory = cwp->path();
|
||||
|
||||
*checkoutDir = workingDirectory + QLatin1Char('/') + directory;
|
||||
|
||||
if (settings.hasAuthentication()) {
|
||||
const QString user = settings.stringValue(SubversionSettings::userKey);
|
||||
const QString pwd = settings.stringValue(SubversionSettings::passwordKey);
|
||||
args = SubversionClient::addAuthenticationOptions(args, user, pwd);
|
||||
}
|
||||
VcsBase::Command *command = new VcsBase::Command(binary, workingDirectory,
|
||||
QProcessEnvironment::systemEnvironment());
|
||||
command->addJob(args, -1);
|
||||
return command;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Subversion
|
||||
|
||||
@@ -44,11 +44,6 @@ public:
|
||||
CheckoutWizardFactory();
|
||||
|
||||
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
|
||||
|
||||
private:
|
||||
// BaseCheckoutWizard
|
||||
VcsBase::Command *createCommand(const QList<QWizardPage*> ¶meterPage,
|
||||
QString *checkoutPath);
|
||||
};
|
||||
|
||||
class CheckoutWizard : public VcsBase::BaseCheckoutWizard
|
||||
@@ -57,6 +52,9 @@ class CheckoutWizard : public VcsBase::BaseCheckoutWizard
|
||||
|
||||
public:
|
||||
CheckoutWizard(const QString &path, QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
VcsBase::Command *createCommand(QString *checkoutDir);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
|
||||
#include <coreplugin/basefilewizard.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
/*!
|
||||
@@ -66,8 +68,15 @@ void BaseCheckoutWizard::setStartedStatus(const QString &title)
|
||||
|
||||
void BaseCheckoutWizard::slotPageChanged(int id)
|
||||
{
|
||||
if (id == m_progressPageId)
|
||||
emit progressPageShown();
|
||||
if (id != m_progressPageId)
|
||||
return;
|
||||
|
||||
VcsBase::Command *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)
|
||||
@@ -77,17 +86,13 @@ void BaseCheckoutWizard::slotTerminated(bool success)
|
||||
button(QWizard::BackButton)->setEnabled(true);
|
||||
}
|
||||
|
||||
void BaseCheckoutWizard::start(Command *command)
|
||||
{
|
||||
// No "back" available while running.
|
||||
button(QWizard::BackButton)->setEnabled(false);
|
||||
m_progressPage->start(command);
|
||||
}
|
||||
|
||||
int BaseCheckoutWizard::exec()
|
||||
QString BaseCheckoutWizard::run()
|
||||
{
|
||||
m_progressPageId = addPage(m_progressPage);
|
||||
return Utils::Wizard::exec();
|
||||
if (Utils::Wizard::exec() == QDialog::Accepted)
|
||||
return m_checkoutDir;
|
||||
else
|
||||
return QString();
|
||||
}
|
||||
|
||||
void BaseCheckoutWizard::reject()
|
||||
|
||||
@@ -49,13 +49,11 @@ public:
|
||||
|
||||
void setTitle(const QString &title);
|
||||
void setStartedStatus(const QString &title);
|
||||
void start(VcsBase::Command *command);
|
||||
|
||||
public slots:
|
||||
int exec();
|
||||
QString run();
|
||||
|
||||
signals:
|
||||
void progressPageShown();
|
||||
protected:
|
||||
virtual VcsBase::Command *createCommand(QString *checkoutDir) = 0;
|
||||
|
||||
private slots:
|
||||
void slotPageChanged(int id);
|
||||
@@ -65,6 +63,7 @@ private slots:
|
||||
private:
|
||||
Internal::CheckoutProgressWizardPage *m_progressPage;
|
||||
int m_progressPageId;
|
||||
QString m_checkoutDir;
|
||||
};
|
||||
|
||||
} // namespace VcsBase
|
||||
|
||||
@@ -71,14 +71,12 @@ public:
|
||||
void clear();
|
||||
|
||||
BaseCheckoutWizard *wizard;
|
||||
QString checkoutPath;
|
||||
};
|
||||
|
||||
void BaseCheckoutWizardFactoryPrivate::clear()
|
||||
{
|
||||
delete wizard;
|
||||
wizard = 0;
|
||||
checkoutPath.clear();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
@@ -107,14 +105,13 @@ void BaseCheckoutWizardFactory::runWizard(const QString &path, QWidget *parent,
|
||||
// Create dialog and launch
|
||||
|
||||
d->wizard = create(path, parent);
|
||||
connect(d->wizard, SIGNAL(progressPageShown()), this, SLOT(slotProgressPageShown()));
|
||||
d->wizard->setWindowTitle(displayName());
|
||||
if (d->wizard->exec() != QDialog::Accepted) {
|
||||
const QString checkoutPath = d->wizard->run();
|
||||
if (checkoutPath.isEmpty()) {
|
||||
d->clear();
|
||||
return;
|
||||
}
|
||||
// Now try to find the project file and open
|
||||
const QString checkoutPath = d->checkoutPath;
|
||||
d->clear();
|
||||
QString errorMessage;
|
||||
const QString projectFile = openProject(checkoutPath, &errorMessage);
|
||||
@@ -175,13 +172,4 @@ QString BaseCheckoutWizardFactory::openProject(const QString &path, QString *err
|
||||
return projectFile;
|
||||
}
|
||||
|
||||
void BaseCheckoutWizardFactory::slotProgressPageShown()
|
||||
{
|
||||
QList<QWizardPage *> pages;
|
||||
foreach (int id, d->wizard->pageIds())
|
||||
pages << d->wizard->page(id);
|
||||
Command *command = createCommand(pages, &(d->checkoutPath));
|
||||
d->wizard->start(command);
|
||||
}
|
||||
|
||||
} // namespace VcsBase
|
||||
|
||||
@@ -60,13 +60,6 @@ public:
|
||||
|
||||
virtual BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const = 0;
|
||||
|
||||
protected:
|
||||
virtual Command *createCommand(const QList<QWizardPage *> ¶meterPages,
|
||||
QString *checkoutPath) = 0;
|
||||
|
||||
private slots:
|
||||
void slotProgressPageShown();
|
||||
|
||||
private:
|
||||
Internal::BaseCheckoutWizardFactoryPrivate *const d;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user