Commit 8c7e8966 authored by cerf's avatar cerf Committed by Tobias Hunger

vcsbase: fix confusing error when no binary specified

A special case is now supported when no VCS binary is specified (left
blank in options) then a default (fallback) binary is used instead.
Class VCSBaseClientSettings is now equipped with defaultBinary() and
setDefaultBinary(). Descendant classes can define the default binary
to be used when needed (see BazaarClientSettings for example).

Task-number: QTCREATORBUG-5666

Change-Id: I74c79df03f820996b31a1cd05201bd88ba5dd081
Merge-request: 364
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
Reviewed-on: http://codereview.qt.nokia.com/2996
parent 97178a91
......@@ -54,7 +54,7 @@ BazaarSettings::BazaarSettings() :
logFormat(QLatin1String("long"))
{
setSettingsGroup(QLatin1String(Constants::BAZAAR));
setBinary(QLatin1String(Constants::BAZAARDEFAULT));
setDefaultBinary(QLatin1String(Constants::BAZAARDEFAULT));
}
BazaarSettings& BazaarSettings::operator=(const BazaarSettings& other)
......
......@@ -46,7 +46,7 @@ namespace Internal {
diffIgnoreBlankLines(false)
{
setSettingsGroup(QLatin1String("Mercurial"));
setBinary(QLatin1String(Constants::MERCURIALDEFAULT));
setDefaultBinary(QLatin1String(Constants::MERCURIALDEFAULT));
}
MercurialSettings& MercurialSettings::operator=(const MercurialSettings& other)
......
......@@ -47,7 +47,6 @@ enum { timeOutDefaultSeconds = 30 };
*/
VCSBaseClientSettings::VCSBaseClientSettings() :
m_binary(),
m_logCount(0),
m_prompt(true),
m_timeoutSeconds(timeOutDefaultSeconds)
......@@ -59,6 +58,8 @@ VCSBaseClientSettings::~VCSBaseClientSettings()
QString VCSBaseClientSettings::binary() const
{
if (m_binary.isEmpty())
return defaultBinary(); // Fallback binary if not specified
return m_binary;
}
......@@ -154,7 +155,7 @@ void VCSBaseClientSettings::writeSettings(QSettings *settings) const
void VCSBaseClientSettings::readSettings(const QSettings *settings)
{
const QString keyRoot = settingsGroup() + QLatin1Char('/');
m_binary = settings->value(keyRoot + QLatin1String("VCS_Path"), QString()).toString();
m_binary = settings->value(keyRoot + QLatin1String("VCS_Path"), defaultBinary()).toString();
m_user = settings->value(keyRoot + QLatin1String("VCS_Username"), QString()).toString();
m_mail = settings->value(keyRoot + QLatin1String("VCS_Email"), QString()).toString();
m_logCount = settings->value(keyRoot + QLatin1String("VCS_LogCount"), QString()).toInt();
......@@ -169,3 +170,13 @@ bool VCSBaseClientSettings::equals(const VCSBaseClientSettings &rhs) const
&& m_logCount == rhs.m_logCount && m_prompt == rhs.m_prompt
&& m_timeoutSeconds == rhs.m_timeoutSeconds;
}
QString VCSBaseClientSettings::defaultBinary() const
{
return m_defaultBinary;
}
void VCSBaseClientSettings::setDefaultBinary(const QString &bin)
{
m_defaultBinary = bin;
}
......@@ -79,8 +79,13 @@ public:
virtual bool equals(const VCSBaseClientSettings &rhs) const;
protected:
QString defaultBinary() const;
void setDefaultBinary(const QString &bin);
private:
QString m_binary;
QString m_defaultBinary;
QStringList m_standardArguments;
QString m_user;
QString m_mail;
......
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