Commit 2ccae82b authored by Tobias Hunger's avatar Tobias Hunger

Vcs: Move vcsBinary and vcsTimeout into VcsBaseClientImpl

Change-Id: Ib14432c85f42606a0437f3848b9dfa2fe63fb2f3
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 73a77328
......@@ -404,12 +404,9 @@ void GerritPlugin::push()
Utils::FileName GerritPlugin::gitBinary()
{
bool ok;
const Utils::FileName git = gitClient()->vcsBinary(&ok);
if (!ok) {
const Utils::FileName git = gitClient()->vcsBinary();
if (git.isEmpty())
VcsBase::VcsOutputWindow::appendError(tr("Git is not available."));
return Utils::FileName();
}
return git;
}
......
......@@ -2452,9 +2452,11 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
}
bool GitClient::launchGitGui(const QString &workingDirectory) {
bool success;
FileName gitBinary = vcsBinary(&success);
if (success) {
bool success = true;
FileName gitBinary = vcsBinary();
if (gitBinary.isEmpty()) {
success = false;
} else {
success = QProcess::startDetached(gitBinary.toString(), QStringList(QLatin1String("gui")),
workingDirectory);
}
......@@ -2483,14 +2485,13 @@ FileName GitClient::gitBinDirectory()
return FileName::fromString(path);
}
FileName GitClient::vcsBinary(bool *ok, QString *errorMessage) const
FileName GitClient::vcsBinary() const
{
return static_cast<GitSettings &>(settings()).gitExecutable(ok, errorMessage);
}
int GitClient::vcsTimeout() const
{
return settings().intValue(GitSettings::timeoutKey);
bool ok;
Utils::FileName binary = static_cast<GitSettings &>(settings()).gitExecutable(&ok);
if (!ok)
return Utils::FileName();
return binary;
}
QTextCodec *GitClient::encoding(const QString &workingDirectory, const QByteArray &configVar) const
......
......@@ -140,8 +140,7 @@ public:
explicit GitClient();
Utils::FileName vcsBinary(bool *ok = 0, QString *errorMessage = 0) const;
int vcsTimeout() const;
Utils::FileName vcsBinary() const;
unsigned gitVersion(QString *errorMessage = 0) const;
QString findRepositoryForDirectory(const QString &dir) const;
......
......@@ -81,9 +81,7 @@ Core::Id GitVersionControl::id() const
bool GitVersionControl::isConfigured() const
{
bool ok = false;
m_client->vcsBinary(&ok);
return ok;
return !m_client->vcsBinary().isEmpty();
}
bool GitVersionControl::supportsOperation(Operation operation) const
......
......@@ -117,6 +117,16 @@ VcsBaseClientSettings &VcsBaseClientImpl::settings() const
return *d->m_clientSettings;
}
Utils::FileName VcsBaseClientImpl::vcsBinary() const
{
return settings().binaryPath();
}
int VcsBaseClientImpl::vcsTimeout() const
{
return settings().intValue(VcsBaseClientSettings::timeoutKey);
}
void VcsBaseClientImpl::saveSettings()
{
settings().writeSettings(Core::ICore::settings());
......@@ -610,16 +620,6 @@ void VcsBaseClient::resetCachedVcsInfo(const QString &workingDir)
Core::VcsManager::resetVersionControlForDirectory(workingDir);
}
Utils::FileName VcsBaseClient::vcsBinary() const
{
return settings().binaryPath();
}
int VcsBaseClient::vcsTimeout() const
{
return settings().intValue(VcsBaseClientSettings::timeoutKey);
}
void VcsBaseClient::statusParser(const QString &text)
{
QList<VcsBaseClient::StatusItem> lineInfoList;
......
......@@ -73,6 +73,9 @@ public:
VcsBaseClientSettings &settings() const;
virtual Utils::FileName vcsBinary() const;
int vcsTimeout() const;
private:
void saveSettings();
......@@ -143,9 +146,6 @@ public:
virtual QProcessEnvironment processEnvironment() const;
Utils::FileName vcsBinary() const;
int vcsTimeout() const;
signals:
void parsedStatus(const QList<VcsBase::VcsBaseClient::StatusItem> &statusList);
// Passes on changed signals from VcsJob to Control
......
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