Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class VcsBaseClientSettings
- {
- public:
- void readSettings(const QSettings *settings)
- {
- foreach (const QString &key, keys()) {
- const QVariant value = readQSettingsValue(key, settings);
- // 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;
- }
- }
- }
- protected:
- virtual QVariant readQSettingsValue(const QString& key, const QSettings* settings) const
- {
- return settings->value(settingsGroup() + QLatin1Char('/') + key, keyDefaultValue(key));
- }
- };
- class SubversionSettings
- {
- protected:
- QVariant readQSettingsValue(const QString& key, const QSettings* settings) const
- {
- QString compatKey = key;
- if (!settings->contains(key)) {
- if (key == VcsBaseClientSettings::binaryPathKey)
- compatKey = QLatin1String("Command");
- else if (key == VcsBaseClientSettings::promptOnSubmitKey)
- compatKey = QLatin1String("PromptForSubmit");
- else if (key == VcsBaseClientSettings::timeoutKey)
- compatKey = QLatin1String("TimeOut");
- }
- return settings->value(settingsGroup() + QLatin1Char('/') + compatKey,
- keyDefaultValue(key));
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement