Depends on D23523
Now that SlaveBase::config() is marked deprecated use the new function SlaveBase::mapConfig() instead preventing KConfig I/O when reading config
dfaure |
Frameworks |
Depends on D23523
Now that SlaveBase::config() is marked deprecated use the new function SlaveBase::mapConfig() instead preventing KConfig I/O when reading config
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Looks fine, but a bit verbose. Maybe we could have configValue() overloads (in SlaveBase) for bool, int and QString, to cover the most common use cases?
- mapConfig().value(QStringLiteral("MaxCacheAge"), DEFAULT_MAX_CACHE_AGE).toInt(); + configValue(QStringLiteral("MaxCacheAge"), DEFAULT_MAX_CACHE_AGE);
Given how many calls there are, I would think it's worth it.
(for other more unusual cases like QStringList the current solution remains)
Also, if one day in the far future we want to replace QMap with std::map or other, all these calls to value() will be a PITA, while SlaveBase::configValue() would be trivial to port :)
Good suggestion, I was thinking about this myself.
Done
Also, if one day in the far future we want to replace QMap with std::map or other, all these calls to value() will be a PITA, while SlaveBase::configValue() would be trivial to port :)
:)
There are still a couple of more complicated use of config() to deal with