Commit 434ecd62 authored by Tobias Hunger's avatar Tobias Hunger

Vcs: Use Utils::FileName where possible in the CheckoutWizards

Change-Id: I7e90f2c3468099229620d6713b39b69d8dbe8ff0
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 33878202
......@@ -51,7 +51,7 @@ CloneWizardFactory::CloneWizardFactory()
setDisplayName(tr("Bazaar Clone (Or Branch)"));
}
VcsBase::BaseCheckoutWizard *CloneWizardFactory::create(const QString &path, QWidget *parent) const
VcsBase::BaseCheckoutWizard *CloneWizardFactory::create(const Utils::FileName &path, QWidget *parent) const
{
return new CloneWizard(path, parent);
}
......@@ -60,7 +60,7 @@ VcsBase::BaseCheckoutWizard *CloneWizardFactory::create(const QString &path, QWi
// CloneWizard:
// --------------------------------------------------------------------
CloneWizard::CloneWizard(const QString &path, QWidget *parent) :
CloneWizard::CloneWizard(const Utils::FileName &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
{
setTitle(tr("Cloning"));
......@@ -70,11 +70,11 @@ CloneWizard::CloneWizard(const QString &path, QWidget *parent) :
if (!vc->isConfigured())
addPage(new VcsBase::VcsConfigurationPage(vc));
CloneWizardPage *page = new CloneWizardPage;
page->setPath(path);
page->setPath(path.toString());
addPage(page);
}
VcsBase::Command *CloneWizard::createCommand(QString *checkoutDir)
VcsBase::Command *CloneWizard::createCommand(Utils::FileName *checkoutDir)
{
const CloneWizardPage *cwp = 0;
foreach (int pageId, pageIds()) {
......@@ -86,7 +86,7 @@ VcsBase::Command *CloneWizard::createCommand(QString *checkoutDir)
return 0;
const BazaarSettings &settings = BazaarPlugin::instance()->settings();
*checkoutDir = cwp->path() + QLatin1Char('/') + cwp->directory();
*checkoutDir = Utils::FileName::fromString(cwp->path() + QLatin1Char('/') + cwp->directory());
const CloneOptionsPanel *panel = cwp->cloneOptionsPanel();
QStringList extraOptions;
......
......@@ -45,7 +45,7 @@ class CloneWizardFactory : public VcsBase::BaseCheckoutWizardFactory
public:
CloneWizardFactory();
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
VcsBase::BaseCheckoutWizard *create(const Utils::FileName &path, QWidget *parent = 0) const;
};
class CloneWizard : public VcsBase::BaseCheckoutWizard
......@@ -53,10 +53,10 @@ class CloneWizard : public VcsBase::BaseCheckoutWizard
Q_OBJECT
public:
CloneWizard(const QString &path, QWidget *parent = 0);
CloneWizard(const Utils::FileName &path, QWidget *parent = 0);
protected:
VcsBase::Command *createCommand(QString *checkoutDir);
VcsBase::Command *createCommand(Utils::FileName *checkoutDir);
};
} // namespace Internal
......
......@@ -48,7 +48,7 @@ CheckoutWizardFactory::CheckoutWizardFactory()
setDisplayName(tr("CVS Checkout"));
}
VcsBase::BaseCheckoutWizard *CheckoutWizardFactory::create(const QString &path, QWidget *parent) const
VcsBase::BaseCheckoutWizard *CheckoutWizardFactory::create(const Utils::FileName &path, QWidget *parent) const
{
return new CheckoutWizard(path, parent);
}
......@@ -57,18 +57,18 @@ VcsBase::BaseCheckoutWizard *CheckoutWizardFactory::create(const QString &path,
// CheckoutWizard:
// --------------------------------------------------------------------
CheckoutWizard::CheckoutWizard(const QString &path, QWidget *parent) :
CheckoutWizard::CheckoutWizard(const Utils::FileName &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
{
const Core::IVersionControl *vc = CvsPlugin::instance()->versionControl();
if (!vc->isConfigured())
addPage(new VcsBase::VcsConfigurationPage(vc));
CheckoutWizardPage *cwp = new CheckoutWizardPage;
cwp->setPath(path);
cwp->setPath(path.toString());
addPage(cwp);
}
VcsBase::Command *CheckoutWizard::createCommand(QString *checkoutDir)
VcsBase::Command *CheckoutWizard::createCommand(Utils::FileName *checkoutDir)
{
// Collect parameters for the checkout command.
// CVS does not allow for checking out into a different directory.
......@@ -86,7 +86,7 @@ VcsBase::Command *CheckoutWizard::createCommand(QString *checkoutDir)
const QString repository = cwp->repository();
args << QLatin1String("checkout") << repository;
const QString workingDirectory = cwp->path();
*checkoutDir = workingDirectory + QLatin1Char('/') + repository;
*checkoutDir = Utils::FileName::fromString(workingDirectory + QLatin1Char('/') + repository);
VcsBase::Command *command = new VcsBase::Command(binary, workingDirectory,
QProcessEnvironment::systemEnvironment());
......
......@@ -43,7 +43,7 @@ class CheckoutWizardFactory : public VcsBase::BaseCheckoutWizardFactory
public:
CheckoutWizardFactory();
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
VcsBase::BaseCheckoutWizard *create(const Utils::FileName &path, QWidget *parent = 0) const;
};
class CheckoutWizard : public VcsBase::BaseCheckoutWizard
......@@ -51,10 +51,10 @@ class CheckoutWizard : public VcsBase::BaseCheckoutWizard
Q_OBJECT
public:
CheckoutWizard(const QString &path, QWidget *parent = 0);
CheckoutWizard(const Utils::FileName &path, QWidget *parent = 0);
protected:
VcsBase::Command *createCommand(QString *checkoutDir);
VcsBase::Command *createCommand(Utils::FileName *checkoutDir);
};
} // namespace Internal
......
......@@ -48,7 +48,7 @@ CloneWizardFactory::CloneWizardFactory()
setDisplayName(tr("Git Repository Clone"));
}
VcsBase::BaseCheckoutWizard *CloneWizardFactory::create(const QString &path, QWidget *parent) const
VcsBase::BaseCheckoutWizard *CloneWizardFactory::create(const Utils::FileName &path, QWidget *parent) const
{
return new CloneWizard(path, parent);
}
......@@ -57,7 +57,7 @@ VcsBase::BaseCheckoutWizard *CloneWizardFactory::create(const QString &path, QWi
// CloneWizard:
// --------------------------------------------------------------------
CloneWizard::CloneWizard(const QString &path, QWidget *parent) :
CloneWizard::CloneWizard(const Utils::FileName &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
{
setTitle(tr("Cloning"));
......@@ -67,11 +67,11 @@ CloneWizard::CloneWizard(const QString &path, QWidget *parent) :
if (!vc->isConfigured())
addPage(new VcsBase::VcsConfigurationPage(vc));
CloneWizardPage *cwp = new CloneWizardPage;
cwp->setPath(path);
cwp->setPath(path.toString());
addPage(cwp);
}
VcsBase::Command *CloneWizard::createCommand(QString *checkoutDir)
VcsBase::Command *CloneWizard::createCommand(Utils::FileName *checkoutDir)
{
// Collect parameters for the clone command.
const CloneWizardPage *cwp = 0;
......
......@@ -43,7 +43,7 @@ class CloneWizardFactory : public VcsBase::BaseCheckoutWizardFactory
public:
CloneWizardFactory();
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
VcsBase::BaseCheckoutWizard *create(const Utils::FileName &path, QWidget *parent = 0) const;
};
class CloneWizard : public VcsBase::BaseCheckoutWizard
......@@ -51,10 +51,10 @@ class CloneWizard : public VcsBase::BaseCheckoutWizard
Q_OBJECT
public:
CloneWizard(const QString &path, QWidget *parent = 0);
CloneWizard(const Utils::FileName &path, QWidget *parent = 0);
protected:
VcsBase::Command *createCommand(QString *checkoutDir);
VcsBase::Command *createCommand(Utils::FileName *checkoutDir);
};
} // namespace Internal
......
......@@ -118,12 +118,12 @@ QString CloneWizardPage::directoryFromRepository(const QString &urlIn) const
return url;
}
VcsBase::Command *CloneWizardPage::createCheckoutJob(QString *checkoutPath) const
VcsBase::Command *CloneWizardPage::createCheckoutJob(Utils::FileName *checkoutPath) const
{
const Internal::GitClient *client = Internal::GitPlugin::instance()->gitClient();
const QString workingDirectory = path();
const QString checkoutDir = directory();
*checkoutPath = workingDirectory + QLatin1Char('/') + checkoutDir;
*checkoutPath = Utils::FileName::fromString(workingDirectory + QLatin1Char('/') + checkoutDir);
const QString checkoutBranch = branch();
......
......@@ -32,7 +32,7 @@
#include <vcsbase/basecheckoutwizardpage.h>
#include <QSharedPointer>
#include <utils/fileutils.h>
namespace VcsBase { class Command; }
......@@ -48,7 +48,7 @@ public:
explicit CloneWizardPage(QWidget *parent = 0);
~CloneWizardPage();
VcsBase::Command *createCheckoutJob(QString *checkoutPath) const;
VcsBase::Command *createCheckoutJob(Utils::FileName *checkoutPath) const;
protected:
QString directoryFromRepository(const QString &r) const;
......
......@@ -77,7 +77,7 @@ GitoriousCloneWizardFactory::GitoriousCloneWizardFactory()
setDisplayName(tr("Gitorious Repository Clone"));
}
VcsBase::BaseCheckoutWizard *GitoriousCloneWizardFactory::create(const QString &path, QWidget *parent) const
VcsBase::BaseCheckoutWizard *GitoriousCloneWizardFactory::create(const Utils::FileName &path, QWidget *parent) const
{
return new GitoriousCloneWizard(path, parent);
}
......@@ -86,7 +86,7 @@ VcsBase::BaseCheckoutWizard *GitoriousCloneWizardFactory::create(const QString &
// GitoriousCloneWizard:
// --------------------------------------------------------------------
GitoriousCloneWizard::GitoriousCloneWizard(const QString &path, QWidget *parent) :
GitoriousCloneWizard::GitoriousCloneWizard(const Utils::FileName &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
{
setTitle(tr("Cloning"));
......@@ -100,7 +100,7 @@ GitoriousCloneWizard::GitoriousCloneWizard(const QString &path, QWidget *parent)
GitoriousProjectWizardPage *projectPage = new GitoriousProjectWizardPage(hostPage);
GitoriousRepositoryWizardPage *repoPage = new GitoriousRepositoryWizardPage(projectPage);
GitoriousCloneWizardPage *clonePage = new GitoriousCloneWizardPage(repoPage);
clonePage->setPath(path);
clonePage->setPath(path.toString());
addPage(hostPage);
addPage(projectPage);
......@@ -108,7 +108,7 @@ GitoriousCloneWizard::GitoriousCloneWizard(const QString &path, QWidget *parent)
addPage(clonePage);
}
VcsBase::Command *GitoriousCloneWizard::createCommand(QString *checkoutDir)
VcsBase::Command *GitoriousCloneWizard::createCommand(Utils::FileName *checkoutDir)
{
const Git::CloneWizardPage *cwp = 0;
foreach (int pageId, pageIds()) {
......
......@@ -45,7 +45,7 @@ class GitoriousCloneWizardFactory : public VcsBase::BaseCheckoutWizardFactory
public:
GitoriousCloneWizardFactory();
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
VcsBase::BaseCheckoutWizard *create(const Utils::FileName &path, QWidget *parent = 0) const;
};
class GitoriousCloneWizard : public VcsBase::BaseCheckoutWizard
......@@ -53,10 +53,10 @@ class GitoriousCloneWizard : public VcsBase::BaseCheckoutWizard
Q_OBJECT
public:
GitoriousCloneWizard(const QString &path, QWidget *parent = 0);
GitoriousCloneWizard(const Utils::FileName &path, QWidget *parent = 0);
protected:
VcsBase::Command *createCommand(QString *checkoutDir);
VcsBase::Command *createCommand(Utils::FileName *checkoutDir);
};
......
......@@ -48,7 +48,7 @@ CloneWizardFactory::CloneWizardFactory()
setDisplayName(tr("Mercurial Clone"));
}
BaseCheckoutWizard *CloneWizardFactory::create(const QString &path, QWidget *parent) const
BaseCheckoutWizard *CloneWizardFactory::create(const Utils::FileName &path, QWidget *parent) const
{
return new CloneWizard(path, parent);
}
......@@ -57,7 +57,7 @@ BaseCheckoutWizard *CloneWizardFactory::create(const QString &path, QWidget *par
// CloneWizard:
// --------------------------------------------------------------------
CloneWizard::CloneWizard(const QString &path, QWidget *parent) :
CloneWizard::CloneWizard(const Utils::FileName &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
{
setTitle(tr("Cloning"));
......@@ -67,11 +67,11 @@ CloneWizard::CloneWizard(const QString &path, QWidget *parent) :
if (!vc->isConfigured())
addPage(new VcsConfigurationPage(vc));
CloneWizardPage *page = new CloneWizardPage;
page->setPath(path);
page->setPath(path.toString());
addPage(page);
}
Command *CloneWizard::createCommand(QString *checkoutDir)
Command *CloneWizard::createCommand(Utils::FileName *checkoutDir)
{
const CloneWizardPage *cwp = 0;
foreach (int pageId, pageIds()) {
......@@ -89,7 +89,7 @@ Command *CloneWizard::createCommand(QString *checkoutDir)
QStringList args;
args << QLatin1String("clone") << cwp->repository() << directory;
*checkoutDir = path + QLatin1Char('/') + directory;
*checkoutDir = Utils::FileName::fromString(path + QLatin1Char('/') + directory);
VcsBase::Command *command = new VcsBase::Command(settings.binaryPath(), path,
QProcessEnvironment::systemEnvironment());
command->addJob(args, -1);
......
......@@ -45,7 +45,7 @@ class CloneWizardFactory : public VcsBase::BaseCheckoutWizardFactory
public:
CloneWizardFactory();
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
VcsBase::BaseCheckoutWizard *create(const Utils::FileName &path, QWidget *parent = 0) const;
private:
const QIcon m_icon;
......@@ -56,10 +56,10 @@ class CloneWizard : public VcsBase::BaseCheckoutWizard
Q_OBJECT
public:
CloneWizard(const QString &path, QWidget *parent = 0);
CloneWizard(const Utils::FileName &path, QWidget *parent = 0);
protected:
VcsBase::Command *createCommand(QString *checkoutDir);
VcsBase::Command *createCommand(Utils::FileName *checkoutDir);
};
} //namespace Internal
......
......@@ -51,7 +51,7 @@ CheckoutWizardFactory::CheckoutWizardFactory()
setDisplayName(tr("Subversion Checkout"));
}
VcsBase::BaseCheckoutWizard *CheckoutWizardFactory::create(const QString &path, QWidget *parent) const
VcsBase::BaseCheckoutWizard *CheckoutWizardFactory::create(const Utils::FileName &path, QWidget *parent) const
{
return new CheckoutWizard(path, parent);
}
......@@ -60,18 +60,18 @@ VcsBase::BaseCheckoutWizard *CheckoutWizardFactory::create(const QString &path,
// CheckoutWizard:
// --------------------------------------------------------------------
CheckoutWizard::CheckoutWizard(const QString &path, QWidget *parent) :
CheckoutWizard::CheckoutWizard(const Utils::FileName &path, QWidget *parent) :
VcsBase::BaseCheckoutWizard(path, parent)
{
const Core::IVersionControl *vc = SubversionPlugin::instance()->versionControl();
if (!vc->isConfigured())
addPage(new VcsBase::VcsConfigurationPage(vc));
CheckoutWizardPage *cwp = new CheckoutWizardPage;
cwp->setPath(path);
cwp->setPath(path.toString());
addPage(cwp);
}
VcsBase::Command *CheckoutWizard::createCommand(QString *checkoutDir)
VcsBase::Command *CheckoutWizard::createCommand(Utils::FileName *checkoutDir)
{
// Collect parameters for the checkout command.
const CheckoutWizardPage *cwp = 0;
......@@ -88,7 +88,7 @@ VcsBase::Command *CheckoutWizard::createCommand(QString *checkoutDir)
args << QLatin1String("checkout") << cwp->repository() << directory;
const QString workingDirectory = cwp->path();
*checkoutDir = workingDirectory + QLatin1Char('/') + directory;
*checkoutDir = Utils::FileName::fromString(workingDirectory + QLatin1Char('/') + directory);
if (settings.hasAuthentication()) {
const QString user = settings.stringValue(SubversionSettings::userKey);
......
......@@ -43,7 +43,7 @@ class CheckoutWizardFactory : public VcsBase::BaseCheckoutWizardFactory
public:
CheckoutWizardFactory();
VcsBase::BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const;
VcsBase::BaseCheckoutWizard *create(const Utils::FileName &path, QWidget *parent = 0) const;
};
class CheckoutWizard : public VcsBase::BaseCheckoutWizard
......@@ -51,10 +51,10 @@ class CheckoutWizard : public VcsBase::BaseCheckoutWizard
Q_OBJECT
public:
CheckoutWizard(const QString &path, QWidget *parent = 0);
CheckoutWizard(const Utils::FileName &path, QWidget *parent = 0);
protected:
VcsBase::Command *createCommand(QString *checkoutDir);
VcsBase::Command *createCommand(Utils::FileName *checkoutDir);
};
} // namespace Internal
......
......@@ -46,7 +46,7 @@
namespace VcsBase {
BaseCheckoutWizard::BaseCheckoutWizard(const QString &path, QWidget *parent) :
BaseCheckoutWizard::BaseCheckoutWizard(const Utils::FileName &path, QWidget *parent) :
Utils::Wizard(parent),
m_progressPage(new Internal::CheckoutProgressWizardPage),
m_progressPageId(-1)
......@@ -86,13 +86,13 @@ void BaseCheckoutWizard::slotTerminated(bool success)
button(QWizard::BackButton)->setEnabled(true);
}
QString BaseCheckoutWizard::run()
Utils::FileName BaseCheckoutWizard::run()
{
m_progressPageId = addPage(m_progressPage);
if (Utils::Wizard::exec() == QDialog::Accepted)
return m_checkoutDir;
else
return QString();
return Utils::FileName();
}
void BaseCheckoutWizard::reject()
......
......@@ -32,7 +32,7 @@
#include "vcsbase_global.h"
#include <QList>
#include <utils/fileutils.h>
#include <utils/wizard.h>
namespace VcsBase {
......@@ -45,15 +45,15 @@ class VCSBASE_EXPORT BaseCheckoutWizard : public Utils::Wizard
Q_OBJECT
public:
explicit BaseCheckoutWizard(const QString &path, QWidget *parent = 0);
explicit BaseCheckoutWizard(const Utils::FileName &path, QWidget *parent = 0);
void setTitle(const QString &title);
void setStartedStatus(const QString &title);
QString run();
Utils::FileName run();
protected:
virtual VcsBase::Command *createCommand(QString *checkoutDir) = 0;
virtual VcsBase::Command *createCommand(Utils::FileName *checkoutDir) = 0;
private slots:
void slotPageChanged(int id);
......@@ -63,7 +63,7 @@ private slots:
private:
Internal::CheckoutProgressWizardPage *m_progressPage;
int m_progressPageId;
QString m_checkoutDir;
Utils::FileName m_checkoutDir;
};
} // namespace VcsBase
......
......@@ -34,11 +34,13 @@
#include <projectexplorer/projectexplorer.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <QCoreApplication>
#include <QDir>
#include <QMessageBox>
#include <QScopedPointer>
/*!
\class VcsBase::BaseCheckoutWizard
......@@ -79,9 +81,9 @@ void BaseCheckoutWizardFactory::runWizard(const QString &path, QWidget *parent,
Q_UNUSED(extraValues);
// Create dialog and launch
QString checkoutPath;
Utils::FileName checkoutPath;
{
QScopedPointer<BaseCheckoutWizard> wizard(create(path, parent));
QScopedPointer<BaseCheckoutWizard> wizard(create(Utils::FileName::fromString(path), parent));
wizard->setWindowTitle(displayName());
checkoutPath = wizard->run();
}
......@@ -94,7 +96,7 @@ void BaseCheckoutWizardFactory::runWizard(const QString &path, QWidget *parent,
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(QDir::toNativeSeparators(checkoutPath)));
tr("Failed to open project in \"%1\".").arg(checkoutPath.toUserOutput()));
msgBox.setDetailedText(errorMessage);
msgBox.addButton(QMessageBox::Ok);
msgBox.exec();
......@@ -129,13 +131,13 @@ static QFileInfoList findProjectFiles(const QDir &projectDir, QString *errorMess
return projectFiles;
}
QString BaseCheckoutWizardFactory::openProject(const QString &path, QString *errorMessage)
QString BaseCheckoutWizardFactory::openProject(const Utils::FileName &path, QString *errorMessage)
{
// Search the directory for project files
const QDir dir(path);
const QDir dir(path.toString());
if (!dir.exists()) {
*errorMessage = tr("\"%1\" does not exist.").
arg(QDir::toNativeSeparators(path)); // Should not happen
arg(path.toUserOutput()); // Should not happen
return QString();
}
QFileInfoList projectFiles = findProjectFiles(dir, errorMessage);
......
......@@ -33,12 +33,7 @@
#include "vcsbase_global.h"
#include <coreplugin/iwizardfactory.h>
#include <QSharedPointer>
#include <QList>
QT_BEGIN_NAMESPACE
class QWizardPage;
QT_END_NAMESPACE
#include <utils/fileutils.h>
namespace VcsBase {
class BaseCheckoutWizard;
......@@ -53,9 +48,9 @@ public:
void runWizard(const QString &path, QWidget *parent, const QString &platform, const QVariantMap &extraValues);
static QString openProject(const QString &path, QString *errorMessage);
static QString openProject(const Utils::FileName &path, QString *errorMessage);
virtual BaseCheckoutWizard *create(const QString &path, QWidget *parent = 0) const = 0;
virtual BaseCheckoutWizard *create(const Utils::FileName &path, QWidget *parent = 0) const = 0;
};
} // namespace VcsBase
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment