bool GlobalConfig::hideAdvancedDevices() const { K_D(const GlobalConfig); //The devices need to be stored independently for every backend const QSettingsGroup generalGroup(&d->config, QLatin1String("General")); return generalGroup.value(QLatin1String("HideAdvancedDevices"), true); }
static QList<int> listSortedByConfig(const QSettingsGroup &backendConfig, Phonon::Category category, QList<int> &defaultList) { if (defaultList.size() <= 1) { // nothing to sort return defaultList; } else { // make entries unique QSet<int> seen; QMutableListIterator<int> it(defaultList); while (it.hasNext()) { if (seen.contains(it.next())) { it.remove(); } else { seen.insert(it.value()); } } } QString categoryKey = QLatin1String("Category_") + QString::number(static_cast<int>(category)); if (!backendConfig.hasKey(categoryKey)) { // no list in config for the given category categoryKey = QLatin1String("Category_") + QString::number(static_cast<int>(Phonon::NoCategory)); if (!backendConfig.hasKey(categoryKey)) { // no list in config for NoCategory return defaultList; } } //Now the list from m_config QList<int> deviceList = backendConfig.value(categoryKey, QList<int>()); //if there are devices in m_config that the backend doesn't report, remove them from the list QMutableListIterator<int> i(deviceList); while (i.hasNext()) { if (0 == defaultList.removeAll(i.next())) { i.remove(); } } //if the backend reports more devices that are not in m_config append them to the list deviceList += defaultList; return deviceList; }