SHOW:
|
|
- or go back to the newest paste.
| 1 | class VcsBaseClientSettings | |
| 2 | {
| |
| 3 | public: | |
| 4 | void readSettings(const QSettings *settings) | |
| 5 | {
| |
| 6 | foreach (const QString &key, keys()) {
| |
| 7 | - | const QVariant value = readQSettingsValue(key); |
| 7 | + | const QVariant value = readQSettingsValue(key, settings); |
| 8 | // For some reason QSettings always return QVariant(QString) when the | |
| 9 | // key exists. The type is explicited to avoid wrong conversions | |
| 10 | switch (valueType(key)) {
| |
| 11 | case QVariant::Int: | |
| 12 | setValue(key, value.toInt()); | |
| 13 | break; | |
| 14 | case QVariant::Bool: | |
| 15 | setValue(key, value.toBool()); | |
| 16 | break; | |
| 17 | case QVariant::String: | |
| 18 | setValue(key, value.toString()); | |
| 19 | break; | |
| 20 | default: | |
| 21 | break; | |
| 22 | } | |
| 23 | } | |
| 24 | } | |
| 25 | ||
| 26 | protected: | |
| 27 | virtual QVariant readQSettingsValue(const QString& key, const QSettings* settings) const | |
| 28 | {
| |
| 29 | return settings->value(settingsGroup() + QLatin1Char('/') + key, keyDefaultValue(key));
| |
| 30 | } | |
| 31 | }; | |
| 32 | ||
| 33 | ||
| 34 | ||
| 35 | class SubversionSettings | |
| 36 | {
| |
| 37 | protected: | |
| 38 | QVariant readQSettingsValue(const QString& key, const QSettings* settings) const | |
| 39 | {
| |
| 40 | QString compatKey = key; | |
| 41 | if (!settings->contains(key)) {
| |
| 42 | if (key == VcsBaseClientSettings::binaryPathKey) | |
| 43 | compatKey = QLatin1String("Command");
| |
| 44 | else if (key == VcsBaseClientSettings::promptOnSubmitKey) | |
| 45 | compatKey = QLatin1String("PromptForSubmit");
| |
| 46 | else if (key == VcsBaseClientSettings::timeoutKey) | |
| 47 | compatKey = QLatin1String("TimeOut");
| |
| 48 | } | |
| 49 | return settings->value(settingsGroup() + QLatin1Char('/') + compatKey,
| |
| 50 | keyDefaultValue(key)); | |
| 51 | } | |
| 52 | }; |