forked from qt-creator/qt-creator
VcsBase: Remove VcsBaseClientSettings
It's replaced by VcsBaseSettings. Change-Id: I60a0e4e267337f71e8a32b9b220565b765c973b1 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -99,7 +99,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
BazaarClient::BazaarClient(BazaarSettings *settings) : VcsBaseClient(nullptr, settings)
|
||||
BazaarClient::BazaarClient(BazaarSettings *settings) : VcsBaseClient(settings)
|
||||
{
|
||||
setDiffConfigCreator([settings](QToolBar *toolBar) {
|
||||
return new BazaarDiffConfig(*settings, toolBar);
|
||||
|
@@ -193,7 +193,7 @@ private:
|
||||
class CvsClient : public VcsBaseClient
|
||||
{
|
||||
public:
|
||||
explicit CvsClient(CvsSettings *settings) : VcsBaseClient(nullptr, settings)
|
||||
explicit CvsClient(CvsSettings *settings) : VcsBaseClient(settings)
|
||||
{
|
||||
setDiffConfigCreator([settings](QToolBar *toolBar) {
|
||||
return new CvsDiffConfig(*settings, toolBar);
|
||||
|
@@ -784,7 +784,7 @@ static inline void msgCannotRun(const QStringList &args, const QString &workingD
|
||||
// ---------------- GitClient
|
||||
|
||||
GitClient::GitClient(GitSettings *settings)
|
||||
: VcsBase::VcsBaseClientImpl(nullptr, settings)
|
||||
: VcsBase::VcsBaseClientImpl(settings)
|
||||
{
|
||||
m_instance = this;
|
||||
m_gitQtcEditor = QString::fromLatin1("\"%1\" -client -block -pid %2")
|
||||
@@ -799,7 +799,7 @@ GitClient *GitClient::instance()
|
||||
|
||||
GitSettings &GitClient::settings()
|
||||
{
|
||||
return static_cast<GitSettings &>(m_instance->baseSettings());
|
||||
return static_cast<GitSettings &>(m_instance->VcsBaseClientImpl::settings());
|
||||
}
|
||||
|
||||
QString GitClient::findRepositoryForDirectory(const QString &directory) const
|
||||
|
@@ -86,7 +86,7 @@ QStringList MercurialDiffEditorController::addConfigurationArguments(const QStri
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
MercurialClient::MercurialClient(MercurialSettings *settings) : VcsBaseClient(nullptr, settings)
|
||||
MercurialClient::MercurialClient(MercurialSettings *settings) : VcsBaseClient(settings)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -458,8 +458,8 @@ void MercurialClient::requestReload(const QString &documentId, const QString &so
|
||||
controller->setReloader([controller, args] {
|
||||
controller->runCommand({controller->addConfigurationArguments(args)});
|
||||
});
|
||||
controller->setVcsBinary(baseSettings().binaryPath.filePath());
|
||||
controller->setVcsTimeoutS(baseSettings().timeout.value());
|
||||
controller->setVcsBinary(settings().binaryPath.filePath());
|
||||
controller->setVcsTimeoutS(settings().timeout.value());
|
||||
controller->setProcessEnvironment(processEnvironment());
|
||||
controller->setWorkingDirectory(workingDirectory);
|
||||
|
||||
|
@@ -69,7 +69,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
SubversionClient::SubversionClient(SubversionSettings *settings) : VcsBaseClient(nullptr, settings)
|
||||
SubversionClient::SubversionClient(SubversionSettings *settings) : VcsBaseClient(settings)
|
||||
{
|
||||
setLogConfigCreator([settings](QToolBar *toolBar) {
|
||||
return new SubversionLogConfig(*settings, toolBar);
|
||||
@@ -83,7 +83,7 @@ bool SubversionClient::doCommit(const QString &repositoryRoot,
|
||||
{
|
||||
const QStringList svnExtraOptions =
|
||||
QStringList(extraOptions)
|
||||
<< SubversionClient::addAuthenticationOptions(static_cast<SubversionSettings &>(baseSettings()))
|
||||
<< SubversionClient::addAuthenticationOptions(static_cast<SubversionSettings &>(settings()))
|
||||
<< QLatin1String(Constants::NON_INTERACTIVE_OPTION)
|
||||
<< QLatin1String("--encoding") << QLatin1String("UTF-8")
|
||||
<< QLatin1String("--file") << commitMessageFile;
|
||||
@@ -260,7 +260,7 @@ SubversionDiffEditorController *SubversionClient::findOrCreateDiffEditor(const Q
|
||||
const QString &title,
|
||||
const QString &workingDirectory)
|
||||
{
|
||||
auto &settings = static_cast<SubversionSettings &>(baseSettings());
|
||||
auto &settings = static_cast<SubversionSettings &>(this->settings());
|
||||
IDocument *document = DiffEditorController::findOrCreateDocument(documentId, title);
|
||||
auto controller = qobject_cast<SubversionDiffEditorController *>(
|
||||
DiffEditorController::controller(document));
|
||||
@@ -296,7 +296,7 @@ void SubversionClient::log(const QString &workingDir,
|
||||
const QStringList &extraOptions,
|
||||
bool enableAnnotationContextMenu)
|
||||
{
|
||||
auto &settings = static_cast<SubversionSettings &>(baseSettings());
|
||||
auto &settings = static_cast<SubversionSettings &>(this->settings());
|
||||
const int logCount = settings.logCount.value();
|
||||
QStringList svnExtraOptions = extraOptions;
|
||||
svnExtraOptions.append(SubversionClient::addAuthenticationOptions(settings));
|
||||
|
@@ -73,32 +73,22 @@ static Core::IEditor *locateEditor(const char *property, const QString &entry)
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
VcsBaseClientImpl::VcsBaseClientImpl(VcsBaseClientSettings *settings, VcsBaseSettings *baseSettings) :
|
||||
m_clientSettings(settings), m_baseSettings(baseSettings)
|
||||
VcsBaseClientImpl::VcsBaseClientImpl(VcsBaseSettings *baseSettings)
|
||||
: m_baseSettings(baseSettings)
|
||||
{
|
||||
if (settings) {
|
||||
m_defaultSettings = *m_clientSettings;
|
||||
m_clientSettings->readSettings(Core::ICore::settings());
|
||||
} else {
|
||||
m_baseSettings->readSettings(Core::ICore::settings());
|
||||
}
|
||||
m_baseSettings->readSettings(Core::ICore::settings());
|
||||
connect(Core::ICore::instance(), &Core::ICore::saveSettingsRequested,
|
||||
this, &VcsBaseClientImpl::saveSettings);
|
||||
}
|
||||
|
||||
VcsBaseClientSettings &VcsBaseClientImpl::settings() const
|
||||
{
|
||||
return *m_clientSettings;
|
||||
}
|
||||
|
||||
VcsBaseSettings &VcsBaseClientImpl::baseSettings() const
|
||||
VcsBaseSettings &VcsBaseClientImpl::settings() const
|
||||
{
|
||||
return *m_baseSettings;
|
||||
}
|
||||
|
||||
FilePath VcsBaseClientImpl::vcsBinary() const
|
||||
{
|
||||
return settings().binaryPath();
|
||||
return m_baseSettings->binaryPath.filePath();
|
||||
}
|
||||
|
||||
VcsCommand *VcsBaseClientImpl::createCommand(const QString &workingDirectory,
|
||||
@@ -224,8 +214,6 @@ SynchronousProcessResponse VcsBaseClientImpl::vcsSynchronousExec(const QString &
|
||||
|
||||
int VcsBaseClientImpl::vcsTimeoutS() const
|
||||
{
|
||||
if (m_clientSettings)
|
||||
return m_clientSettings->vcsTimeoutS();
|
||||
return m_baseSettings->timeout.value();
|
||||
}
|
||||
|
||||
@@ -261,14 +249,11 @@ VcsBaseEditorWidget *VcsBaseClientImpl::createVcsEditor(Utils::Id kind, QString
|
||||
|
||||
void VcsBaseClientImpl::saveSettings()
|
||||
{
|
||||
if (m_clientSettings)
|
||||
m_clientSettings->writeSettings(Core::ICore::settings(), m_defaultSettings);
|
||||
else
|
||||
m_baseSettings->writeSettings(Core::ICore::settings());
|
||||
m_baseSettings->writeSettings(Core::ICore::settings());
|
||||
}
|
||||
|
||||
VcsBaseClient::VcsBaseClient(VcsBaseClientSettings *settings, VcsBaseSettings *baseSettings) :
|
||||
VcsBaseClientImpl(settings, baseSettings)
|
||||
VcsBaseClient::VcsBaseClient(VcsBaseSettings *baseSettings)
|
||||
: VcsBaseClientImpl(baseSettings)
|
||||
{
|
||||
qRegisterMetaType<QVariant>();
|
||||
}
|
||||
|
@@ -58,12 +58,10 @@ class VCSBASE_EXPORT VcsBaseClientImpl : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VcsBaseClientImpl(VcsBaseClientSettings *settings,
|
||||
VcsBaseSettings *baseSettings = nullptr);
|
||||
explicit VcsBaseClientImpl(VcsBaseSettings *baseSettings);
|
||||
~VcsBaseClientImpl() override = default;
|
||||
|
||||
VcsBaseClientSettings &settings() const; // FIXME: Phase out.
|
||||
VcsBaseSettings &baseSettings() const; // FIXME: Rename into settings() when the original is gone.
|
||||
VcsBaseSettings &settings() const;
|
||||
|
||||
virtual Utils::FilePath vcsBinary() const;
|
||||
int vcsTimeoutS() const;
|
||||
@@ -130,8 +128,6 @@ protected:
|
||||
private:
|
||||
void saveSettings();
|
||||
|
||||
VcsBaseClientSettings *m_clientSettings; // "old" style.
|
||||
VcsBaseClientSettings m_defaultSettings;
|
||||
VcsBaseSettings *m_baseSettings = nullptr; // Aspect based.
|
||||
};
|
||||
|
||||
@@ -148,8 +144,7 @@ public:
|
||||
QString file;
|
||||
};
|
||||
|
||||
explicit VcsBaseClient(VcsBaseClientSettings *settings,
|
||||
VcsBaseSettings *baseSettings = nullptr);
|
||||
explicit VcsBaseClient(VcsBaseSettings *baseSettings);
|
||||
|
||||
virtual bool synchronousCreateRepository(const QString &workingDir,
|
||||
const QStringList &extraOptions = QStringList());
|
||||
|
@@ -38,367 +38,8 @@
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace {
|
||||
|
||||
class SettingValue
|
||||
{
|
||||
public:
|
||||
union Composite
|
||||
{
|
||||
QString *strPtr; // Union can't store class objects ...
|
||||
int intValue;
|
||||
bool boolValue;
|
||||
};
|
||||
|
||||
SettingValue() = default;
|
||||
|
||||
explicit SettingValue(const QVariant &v) :
|
||||
m_type(v.type())
|
||||
{
|
||||
switch (v.type()) {
|
||||
case QVariant::UInt:
|
||||
m_type = QVariant::Int;
|
||||
Q_FALLTHROUGH();
|
||||
case QVariant::Int:
|
||||
m_comp.intValue = v.toInt();
|
||||
break;
|
||||
case QVariant::Bool:
|
||||
m_comp.boolValue = v.toBool();
|
||||
break;
|
||||
case QVariant::String:
|
||||
m_comp.strPtr = new QString(v.toString());
|
||||
break;
|
||||
default:
|
||||
m_type = QVariant::Invalid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SettingValue(const SettingValue &other) :
|
||||
m_comp(other.m_comp),
|
||||
m_type(other.type())
|
||||
{
|
||||
copyInternalString(other);
|
||||
}
|
||||
|
||||
~SettingValue()
|
||||
{
|
||||
deleteInternalString();
|
||||
}
|
||||
|
||||
SettingValue &operator=(const SettingValue &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
deleteInternalString();
|
||||
m_type = other.type();
|
||||
m_comp = other.m_comp;
|
||||
copyInternalString(other);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
QString stringValue(const QString &defaultString = QString()) const
|
||||
{
|
||||
if (type() == QVariant::String && m_comp.strPtr != nullptr)
|
||||
return *(m_comp.strPtr);
|
||||
return defaultString;
|
||||
}
|
||||
|
||||
QVariant::Type type() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
static bool isUsableVariantType(QVariant::Type varType)
|
||||
{
|
||||
return varType == QVariant::UInt || varType == QVariant::Int ||
|
||||
varType == QVariant::Bool || varType == QVariant::String;
|
||||
}
|
||||
|
||||
Composite m_comp;
|
||||
|
||||
private:
|
||||
void deleteInternalString()
|
||||
{
|
||||
if (m_type == QVariant::String && m_comp.strPtr != nullptr) {
|
||||
delete m_comp.strPtr;
|
||||
m_comp.strPtr = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void copyInternalString(const SettingValue &other)
|
||||
{
|
||||
if (type() == QVariant::String) {
|
||||
const QString *otherString = other.m_comp.strPtr;
|
||||
m_comp.strPtr = new QString(otherString != nullptr ? *otherString : QString());
|
||||
}
|
||||
}
|
||||
|
||||
QVariant::Type m_type = QVariant::Invalid;
|
||||
};
|
||||
|
||||
bool operator==(const SettingValue &lhs, const SettingValue &rhs)
|
||||
{
|
||||
if (lhs.type() == rhs.type()) {
|
||||
switch (lhs.type()) {
|
||||
case QVariant::Int:
|
||||
return lhs.m_comp.intValue == rhs.m_comp.intValue;
|
||||
case QVariant::Bool:
|
||||
return lhs.m_comp.boolValue == rhs.m_comp.boolValue;
|
||||
case QVariant::String:
|
||||
return lhs.stringValue() == rhs.stringValue();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // Anonymous namespace
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class VcsBaseClientSettingsPrivate : public QSharedData
|
||||
{
|
||||
public:
|
||||
VcsBaseClientSettingsPrivate() {}
|
||||
|
||||
VcsBaseClientSettingsPrivate(const VcsBaseClientSettingsPrivate &other) :
|
||||
QSharedData(other),
|
||||
m_valueHash(other.m_valueHash),
|
||||
m_defaultValueHash(other.m_defaultValueHash),
|
||||
m_settingsGroup(other.m_settingsGroup),
|
||||
m_binaryFullPath(other.m_binaryFullPath)
|
||||
{
|
||||
}
|
||||
|
||||
QHash<QString, SettingValue> m_valueHash;
|
||||
QVariantHash m_defaultValueHash;
|
||||
QString m_settingsGroup;
|
||||
mutable FilePath m_binaryFullPath;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
/*!
|
||||
\class VcsBase::VcsBaseClientSettings
|
||||
|
||||
\brief The VcsBaseClientSettings class contains settings used in
|
||||
VcsBaseClient.
|
||||
|
||||
\sa VcsBase::VcsBaseClient
|
||||
*/
|
||||
|
||||
const QLatin1String VcsBaseClientSettings::binaryPathKey("BinaryPath");
|
||||
const QLatin1String VcsBaseClientSettings::userNameKey("Username");
|
||||
const QLatin1String VcsBaseClientSettings::userEmailKey("UserEmail");
|
||||
const QLatin1String VcsBaseClientSettings::logCountKey("LogCount");
|
||||
const QLatin1String VcsBaseClientSettings::promptOnSubmitKey("PromptOnSubmit");
|
||||
const QLatin1String VcsBaseClientSettings::timeoutKey("Timeout");
|
||||
const QLatin1String VcsBaseClientSettings::pathKey("Path");
|
||||
|
||||
VcsBaseClientSettings::VcsBaseClientSettings() :
|
||||
d(new Internal::VcsBaseClientSettingsPrivate)
|
||||
{
|
||||
declareKey(binaryPathKey, QString());
|
||||
declareKey(userNameKey, QString());
|
||||
declareKey(userEmailKey, QString());
|
||||
declareKey(logCountKey, 100);
|
||||
declareKey(promptOnSubmitKey, true);
|
||||
declareKey(timeoutKey, 30);
|
||||
declareKey(pathKey, QString());
|
||||
}
|
||||
|
||||
VcsBaseClientSettings::VcsBaseClientSettings(const VcsBaseClientSettings &other) :
|
||||
d(other.d)
|
||||
{
|
||||
}
|
||||
|
||||
VcsBaseClientSettings &VcsBaseClientSettings::operator=(const VcsBaseClientSettings &other)
|
||||
{
|
||||
if (this != &other)
|
||||
d = other.d;
|
||||
return *this;
|
||||
}
|
||||
|
||||
VcsBaseClientSettings::~VcsBaseClientSettings()
|
||||
{
|
||||
}
|
||||
|
||||
void VcsBaseClientSettings::writeSettings(QSettings *settings,
|
||||
const VcsBaseClientSettings &defaultSettings) const
|
||||
{
|
||||
QTC_ASSERT(!settingsGroup().isEmpty(), return);
|
||||
|
||||
settings->remove(settingsGroup());
|
||||
settings->beginGroup(settingsGroup());
|
||||
foreach (const QString &key, keys())
|
||||
QtcSettings::setValueWithDefault(settings, key, value(key), defaultSettings.value(key));
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void VcsBaseClientSettings::readSettings(const QSettings *settings)
|
||||
{
|
||||
const QString keyRoot = settingsGroup() + QLatin1Char('/');
|
||||
foreach (const QString &key, keys()) {
|
||||
const QVariant value = settings->value(keyRoot + key, keyDefaultValue(key));
|
||||
// For some reason QSettings always return QVariant(QString) when the
|
||||
// key exists. The type is explicited to avoid wrong conversions
|
||||
switch (valueType(key)) {
|
||||
case QVariant::Int:
|
||||
setValue(key, value.toInt());
|
||||
break;
|
||||
case QVariant::Bool:
|
||||
setValue(key, value.toBool());
|
||||
break;
|
||||
case QVariant::String:
|
||||
setValue(key, value.toString());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool VcsBaseClientSettings::equals(const VcsBaseClientSettings &rhs) const
|
||||
{
|
||||
if (this == &rhs)
|
||||
return true;
|
||||
return d->m_valueHash == rhs.d->m_valueHash;
|
||||
}
|
||||
|
||||
QStringList VcsBaseClientSettings::keys() const
|
||||
{
|
||||
return d->m_valueHash.keys();
|
||||
}
|
||||
|
||||
bool VcsBaseClientSettings::hasKey(const QString &key) const
|
||||
{
|
||||
return d->m_valueHash.contains(key);
|
||||
}
|
||||
|
||||
int *VcsBaseClientSettings::intPointer(const QString &key)
|
||||
{
|
||||
if (hasKey(key))
|
||||
return &(d->m_valueHash[key].m_comp.intValue);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool *VcsBaseClientSettings::boolPointer(const QString &key)
|
||||
{
|
||||
if (hasKey(key))
|
||||
return &(d->m_valueHash[key].m_comp.boolValue);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QString *VcsBaseClientSettings::stringPointer(const QString &key)
|
||||
{
|
||||
if (hasKey(key) && valueType(key) == QVariant::String)
|
||||
return d->m_valueHash[key].m_comp.strPtr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int VcsBaseClientSettings::intValue(const QString &key, int defaultValue) const
|
||||
{
|
||||
if (hasKey(key) && valueType(key) == QVariant::Int)
|
||||
return d->m_valueHash[key].m_comp.intValue;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
bool VcsBaseClientSettings::boolValue(const QString &key, bool defaultValue) const
|
||||
{
|
||||
if (hasKey(key) && valueType(key) == QVariant::Bool)
|
||||
return d->m_valueHash[key].m_comp.boolValue;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
QString VcsBaseClientSettings::stringValue(const QString &key, const QString &defaultValue) const
|
||||
{
|
||||
if (hasKey(key))
|
||||
return d->m_valueHash[key].stringValue(defaultValue);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
QVariant VcsBaseClientSettings::value(const QString &key) const
|
||||
{
|
||||
switch (valueType(key)) {
|
||||
case QVariant::Int:
|
||||
return intValue(key);
|
||||
case QVariant::Bool:
|
||||
return boolValue(key);
|
||||
case QVariant::String:
|
||||
return stringValue(key);
|
||||
case QVariant::Invalid:
|
||||
return QVariant();
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
void VcsBaseClientSettings::setValue(const QString &key, const QVariant &v)
|
||||
{
|
||||
if (SettingValue::isUsableVariantType(valueType(key))) {
|
||||
d->m_valueHash.insert(key, SettingValue(v));
|
||||
d->m_binaryFullPath.clear();
|
||||
}
|
||||
}
|
||||
|
||||
QVariant::Type VcsBaseClientSettings::valueType(const QString &key) const
|
||||
{
|
||||
if (hasKey(key))
|
||||
return d->m_valueHash[key].type();
|
||||
return QVariant::Invalid;
|
||||
}
|
||||
|
||||
FilePath VcsBaseClientSettings::binaryPath() const
|
||||
{
|
||||
if (d->m_binaryFullPath.isEmpty()) {
|
||||
const FilePaths searchPaths = Utils::transform(searchPathList(), &FilePath::fromString);
|
||||
d->m_binaryFullPath = Environment::systemEnvironment().searchInPath(
|
||||
stringValue(binaryPathKey), searchPaths);
|
||||
}
|
||||
return d->m_binaryFullPath;
|
||||
}
|
||||
|
||||
int VcsBaseClientSettings::vcsTimeoutS() const
|
||||
{
|
||||
return intValue(VcsBaseClientSettings::timeoutKey);
|
||||
}
|
||||
|
||||
QStringList VcsBaseClientSettings::searchPathList() const
|
||||
{
|
||||
return stringValue(pathKey).split(HostOsInfo::pathListSeparator(), Qt::SkipEmptyParts);
|
||||
}
|
||||
|
||||
QString VcsBaseClientSettings::settingsGroup() const
|
||||
{
|
||||
return d->m_settingsGroup;
|
||||
}
|
||||
|
||||
void VcsBaseClientSettings::setSettingsGroup(const QString &group)
|
||||
{
|
||||
d->m_settingsGroup = group;
|
||||
}
|
||||
|
||||
void VcsBaseClientSettings::declareKey(const QString &key, const QVariant &defaultValue)
|
||||
{
|
||||
if (SettingValue::isUsableVariantType(defaultValue.type())) {
|
||||
d->m_valueHash.insert(key, SettingValue(defaultValue));
|
||||
d->m_defaultValueHash.insert(key, defaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
QVariant VcsBaseClientSettings::keyDefaultValue(const QString &key) const
|
||||
{
|
||||
if (d->m_defaultValueHash.contains(key))
|
||||
return d->m_defaultValueHash.value(key);
|
||||
return QVariant(valueType(key));
|
||||
}
|
||||
|
||||
// VcsBaseSettings
|
||||
|
||||
VcsBaseSettings::VcsBaseSettings()
|
||||
{
|
||||
setAutoApply(false);
|
||||
|
@@ -29,14 +29,8 @@
|
||||
|
||||
#include <utils/aspects.h>
|
||||
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
#include <QSharedDataPointer>
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
namespace Internal { class VcsBaseClientSettingsPrivate; }
|
||||
|
||||
class VCSBASE_EXPORT VcsBaseSettings : public Utils::AspectContainer
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(VcsBase::VcsBaseSettings)
|
||||
@@ -63,64 +57,4 @@ private:
|
||||
QString m_settingsGroup;
|
||||
};
|
||||
|
||||
class VCSBASE_EXPORT VcsBaseClientSettings
|
||||
{
|
||||
public:
|
||||
static const QLatin1String binaryPathKey;
|
||||
static const QLatin1String userNameKey;
|
||||
static const QLatin1String userEmailKey;
|
||||
static const QLatin1String logCountKey;
|
||||
static const QLatin1String promptOnSubmitKey;
|
||||
static const QLatin1String timeoutKey; // Seconds
|
||||
static const QLatin1String pathKey;
|
||||
|
||||
VcsBaseClientSettings();
|
||||
VcsBaseClientSettings(const VcsBaseClientSettings &other);
|
||||
VcsBaseClientSettings &operator=(const VcsBaseClientSettings &other);
|
||||
virtual ~VcsBaseClientSettings();
|
||||
|
||||
void writeSettings(QSettings *settings, const VcsBaseClientSettings &defaultSettings) const;
|
||||
void readSettings(const QSettings *settings);
|
||||
|
||||
bool equals(const VcsBaseClientSettings &rhs) const;
|
||||
|
||||
QStringList keys() const;
|
||||
bool hasKey(const QString &key) const;
|
||||
|
||||
int *intPointer(const QString &key);
|
||||
int intValue(const QString &key, int defaultValue = 0) const;
|
||||
|
||||
bool *boolPointer(const QString &key);
|
||||
bool boolValue(const QString &key, bool defaultValue = false) const;
|
||||
|
||||
QString *stringPointer(const QString &key);
|
||||
QString stringValue(const QString &key, const QString &defaultValue = QString()) const;
|
||||
|
||||
QVariant value(const QString &key) const;
|
||||
void setValue(const QString &key, const QVariant &v);
|
||||
QVariant::Type valueType(const QString &key) const;
|
||||
|
||||
Utils::FilePath binaryPath() const;
|
||||
|
||||
QStringList searchPathList() const;
|
||||
int vcsTimeoutS() const;
|
||||
|
||||
protected:
|
||||
QString settingsGroup() const;
|
||||
void setSettingsGroup(const QString &group);
|
||||
|
||||
void declareKey(const QString &key, const QVariant &defaultValue);
|
||||
QVariant keyDefaultValue(const QString &key) const;
|
||||
|
||||
private:
|
||||
friend bool equals(const VcsBaseClientSettings &rhs);
|
||||
friend class VcsBaseClientSettingsPrivate;
|
||||
QSharedDataPointer<Internal::VcsBaseClientSettingsPrivate> d;
|
||||
};
|
||||
|
||||
inline bool operator==(const VcsBaseClientSettings &s1, const VcsBaseClientSettings &s2)
|
||||
{ return s1.equals(s2); }
|
||||
inline bool operator!=(const VcsBaseClientSettings &s1, const VcsBaseClientSettings &s2)
|
||||
{ return !s1.equals(s2); }
|
||||
|
||||
} // namespace VcsBase
|
||||
|
Reference in New Issue
Block a user