//___________________________________________________ void Factory::readConfig() { /* always reload helper this is needed to properly handle color contrast settings changed */ helper().invalidateCaches(); helper().reloadConfig(); // initialize default configuration and read if( !_defaultConfiguration ) _defaultConfiguration = ConfigurationPtr(new Configuration()); _defaultConfiguration->setCurrentGroup( QStringLiteral("Windeco") ); _defaultConfiguration->readConfig(); // create a config object KSharedConfig::Ptr config( KSharedConfig::openConfig( QStringLiteral("oxygenrc") ) ); // clear exceptions and read ExceptionList exceptions; exceptions.readConfig( config ); _exceptions = exceptions.get(); // read shadowCache configuration _shadowCache.readConfig(); _shadowCache.setAnimationsDuration( _defaultConfiguration->shadowAnimationsDuration() ); // background pixmap { KConfigGroup group( config->group("Common") ); helper().setBackgroundPixmap( group.readEntry( "BackgroundPixmap", "" ) ); } }
/** * \brief Get configuration by value. * * \param value configuration value to search for. */ ConfigurationPtr Device::configValue(uint8_t value) throw(USBError) { struct libusb_config_descriptor *config; int rc = libusb_get_config_descriptor_by_value(dev, value, &config); if (rc != LIBUSB_SUCCESS) { throw USBError(libusb_error_name(rc)); } Configuration *result = new Configuration(*this, config); libusb_free_config_descriptor(config); return ConfigurationPtr(result); }
/** * \brief Get active configuaration descriptor. * * This method returns the active device descriptor. The device has to * be open for this to work. This is a restriction imposed by a bug in * libusb-1.0: on Mac OS X, the library causes a segmentation fault when * trying to retrieve the active configuration descriptor of a device that * was not opened. Although it works on other platforms (e.g. Linux), * by enforcing this restriction on all platforms we ensure that code * in Linux cannot inadvertently trigger this bug and cause segementation * faults on Mac OS X. */ ConfigurationPtr Device::activeConfig() throw(USBError) { if (!isOpen()) { throw USBError("device not open"); } struct libusb_config_descriptor *config = NULL; int rc = libusb_get_active_config_descriptor(dev, &config); if (rc != LIBUSB_SUCCESS) { throw USBError(libusb_error_name(rc)); } Configuration *result = new Configuration(*this, config); libusb_free_config_descriptor(config); return ConfigurationPtr(result); }