Merged -r459 from trunk
This commit is contained in:
parent
3cfaf0b0b8
commit
4ed9ca75ba
1 changed files with 11 additions and 11 deletions
|
@ -55,7 +55,7 @@ int Settings::getNumberOfDevices(void) const {
|
||||||
int devices = 0;
|
int devices = 0;
|
||||||
for (CFIndex k = 0; k < size; ++k) {
|
for (CFIndex k = 0; k < size; ++k) {
|
||||||
CFStringRef key = (CFStringRef) CFArrayGetValueAtIndex(cfarray, k);
|
CFStringRef key = (CFStringRef) CFArrayGetValueAtIndex(cfarray, k);
|
||||||
if (CFStringHasPrefix( key, CFSTR("device.") ) &&
|
if (CFStringHasPrefix( key, CFSTR("devices.") ) &&
|
||||||
CFStringHasSuffix( key, CFSTR(".name") ) ) {
|
CFStringHasSuffix( key, CFSTR(".name") ) ) {
|
||||||
devices++;
|
devices++;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ int Settings::getDeviceId(int intDeviceIndex) const {
|
||||||
int id = 0;
|
int id = 0;
|
||||||
for (CFIndex k = 0; k < size; ++k) {
|
for (CFIndex k = 0; k < size; ++k) {
|
||||||
CFStringRef key = (CFStringRef) CFArrayGetValueAtIndex(cfarray, k);
|
CFStringRef key = (CFStringRef) CFArrayGetValueAtIndex(cfarray, k);
|
||||||
if (CFStringHasPrefix( key, CFSTR("device.") ) &&
|
if (CFStringHasPrefix( key, CFSTR("devices.") ) &&
|
||||||
CFStringHasSuffix( key, CFSTR(".name") ) ) {
|
CFStringHasSuffix( key, CFSTR(".name") ) ) {
|
||||||
|
|
||||||
if (index == intDeviceIndex) {
|
if (index == intDeviceIndex) {
|
||||||
|
@ -134,7 +134,7 @@ int Settings::getNextDeviceId() const {
|
||||||
* Remove a device
|
* Remove a device
|
||||||
*/
|
*/
|
||||||
bool Settings::removeDevice(int intDeviceId){
|
bool Settings::removeDevice(int intDeviceId){
|
||||||
CFStringRef filterKey = CFStringCreateWithFormat(0, NULL, CFSTR("device.%d."), intDeviceId); // The key to search for
|
CFStringRef filterKey = CFStringCreateWithFormat(0, NULL, CFSTR("devices.%d."), intDeviceId); // The key to search for
|
||||||
|
|
||||||
CFArrayRef cfarray = CFPreferencesCopyKeyList( d->app_ID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost );
|
CFArrayRef cfarray = CFPreferencesCopyKeyList( d->app_ID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost );
|
||||||
if (!cfarray) return 0;
|
if (!cfarray) return 0;
|
||||||
|
@ -155,9 +155,9 @@ std::string Settings::getStringSetting(int intDeviceId, const std::string &name,
|
||||||
|
|
||||||
CFStringRef key;
|
CFStringRef key;
|
||||||
if (parameter) {
|
if (parameter) {
|
||||||
key = CFStringCreateWithFormat(0, NULL, CFSTR("device.%d.parameters.%@"), intDeviceId, cfname);
|
key = CFStringCreateWithFormat(0, NULL, CFSTR("devices.%d.parameters.%@"), intDeviceId, cfname);
|
||||||
} else {
|
} else {
|
||||||
key = CFStringCreateWithFormat(0, NULL, CFSTR("device.%d.%@"), intDeviceId, cfname);
|
key = CFStringCreateWithFormat(0, NULL, CFSTR("devices.%d.%@"), intDeviceId, cfname);
|
||||||
}
|
}
|
||||||
|
|
||||||
CFStringRef value;
|
CFStringRef value;
|
||||||
|
@ -183,9 +183,9 @@ bool Settings::setStringSetting(int intDeviceId, const std::string &name, const
|
||||||
|
|
||||||
CFStringRef key;
|
CFStringRef key;
|
||||||
if (parameter) {
|
if (parameter) {
|
||||||
key = CFStringCreateWithFormat(0, NULL, CFSTR("device.%d.parameters.%@"), intDeviceId, cfname);
|
key = CFStringCreateWithFormat(0, NULL, CFSTR("devices.%d.parameters.%@"), intDeviceId, cfname);
|
||||||
} else {
|
} else {
|
||||||
key = CFStringCreateWithFormat(0, NULL, CFSTR("device.%d.%@"), intDeviceId, cfname);
|
key = CFStringCreateWithFormat(0, NULL, CFSTR("devices.%d.%@"), intDeviceId, cfname);
|
||||||
}
|
}
|
||||||
|
|
||||||
CFPreferencesSetAppValue( key, cfvalue, d->app_ID );
|
CFPreferencesSetAppValue( key, cfvalue, d->app_ID );
|
||||||
|
@ -200,9 +200,9 @@ int Settings::getIntSetting(int intDeviceId, const std::string &name, bool param
|
||||||
|
|
||||||
CFStringRef key;
|
CFStringRef key;
|
||||||
if (parameter) {
|
if (parameter) {
|
||||||
key = CFStringCreateWithFormat(0, NULL, CFSTR("device.%d.parameters.%@"), intDeviceId, cfname);
|
key = CFStringCreateWithFormat(0, NULL, CFSTR("devices.%d.parameters.%@"), intDeviceId, cfname);
|
||||||
} else {
|
} else {
|
||||||
key = CFStringCreateWithFormat(0, NULL, CFSTR("device.%d.%@"), intDeviceId, cfname);
|
key = CFStringCreateWithFormat(0, NULL, CFSTR("devices.%d.%@"), intDeviceId, cfname);
|
||||||
}
|
}
|
||||||
|
|
||||||
cfvalue = (CFNumberRef)CFPreferencesCopyAppValue(key, d->app_ID);
|
cfvalue = (CFNumberRef)CFPreferencesCopyAppValue(key, d->app_ID);
|
||||||
|
@ -229,9 +229,9 @@ bool Settings::setIntSetting(int intDeviceId, const std::string &name, int value
|
||||||
|
|
||||||
CFStringRef key;
|
CFStringRef key;
|
||||||
if (parameter) {
|
if (parameter) {
|
||||||
key = CFStringCreateWithFormat(0, NULL, CFSTR("device.%d.parameters.%@"), intDeviceId, cfname);
|
key = CFStringCreateWithFormat(0, NULL, CFSTR("devices.%d.parameters.%@"), intDeviceId, cfname);
|
||||||
} else {
|
} else {
|
||||||
key = CFStringCreateWithFormat(0, NULL, CFSTR("device.%d.%@"), intDeviceId, cfname);
|
key = CFStringCreateWithFormat(0, NULL, CFSTR("devices.%d.%@"), intDeviceId, cfname);
|
||||||
}
|
}
|
||||||
|
|
||||||
CFPreferencesSetAppValue( key, cfvalue, d->app_ID );
|
CFPreferencesSetAppValue( key, cfvalue, d->app_ID );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue