void MythDB::ClearSettingsCache(const QString &_key) { d->settingsCacheLock.lockForWrite(); if (_key.isEmpty()) { LOG(VB_DATABASE, LOG_INFO, "Clearing Settings Cache."); d->settingsCache.clear(); d->settingsCache.reserve(settings_reserve); SettingsMap::const_iterator it = d->overriddenSettings.begin(); for (; it != d->overriddenSettings.end(); ++it) { QString mk2 = d->m_localhostname + ' ' + it.key(); mk2.squeeze(); d->settingsCache[it.key()] = *it; d->settingsCache[mk2] = *it; } } else { QString myKey = _key.toLower(); clear(d->settingsCache, d->overriddenSettings, myKey); // To be safe always clear any local[ized] version too QString mkl = myKey.section(QChar(' '), 1); if (!mkl.isEmpty()) clear(d->settingsCache, d->overriddenSettings, mkl); } d->settingsCacheLock.unlock(); }
QString Settings::toString() const { QString result = "{\n"; for (SettingsMap::const_iterator it = _settings.constBegin(); it != _settings.constEnd(); ++it) { result += QString(" \"%1\":\"%2\",\n").arg(_markup(it.key())) .arg(_markup(it.value().toString())); } result += " \"#end\": \"\"\n"; result += "}\n"; return result; }