forked from qt-creator/qt-creator
qtcassert: move actual printing to separate function and enforce style
This also allows simple setting of breakpoints on failed asserts. Change-Id: I6dd84cbfaf659d57e39f3447386cebc0221b2b84 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -51,49 +51,49 @@ static inline QSettings *coreSettings()
|
||||
void SettingsManager::beginGroup(const QString &prefix)
|
||||
{
|
||||
QSettings *settings = coreSettings();
|
||||
QTC_ASSERT(settings, return; )
|
||||
QTC_ASSERT(settings, return);
|
||||
settings->beginGroup(addPrefix(prefix));
|
||||
}
|
||||
|
||||
void SettingsManager::endGroup()
|
||||
{
|
||||
QSettings *settings = coreSettings();
|
||||
QTC_ASSERT(settings, return; )
|
||||
QTC_ASSERT(settings, return);
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
bool SettingsManager::contains(const QString &key) const
|
||||
{
|
||||
const QSettings *settings = coreSettings();
|
||||
QTC_ASSERT(settings, return false; )
|
||||
QTC_ASSERT(settings, return false);
|
||||
return settings->contains(addPrefix(key));
|
||||
}
|
||||
|
||||
void SettingsManager::setValue(const QString &key, const QVariant &value)
|
||||
{
|
||||
QSettings *settings = coreSettings();
|
||||
QTC_ASSERT(settings, return; )
|
||||
QTC_ASSERT(settings, return);
|
||||
settings->setValue(addPrefix(key), value);
|
||||
}
|
||||
|
||||
QVariant SettingsManager::value(const QString &key, const QVariant &defaultValue) const
|
||||
{
|
||||
const QSettings *settings = coreSettings();
|
||||
QTC_ASSERT(settings, return QVariant(); )
|
||||
QTC_ASSERT(settings, return QVariant());
|
||||
return settings->value(addPrefix(key), defaultValue);
|
||||
}
|
||||
|
||||
void SettingsManager::remove(const QString &key)
|
||||
{
|
||||
QSettings *settings = coreSettings();
|
||||
QTC_ASSERT(settings, return; )
|
||||
QTC_ASSERT(settings, return);
|
||||
settings->remove(addPrefix(key));
|
||||
}
|
||||
|
||||
QString SettingsManager::addPrefix(const QString &name) const
|
||||
{
|
||||
const QSettings *settings = coreSettings();
|
||||
QTC_ASSERT(settings, return name; )
|
||||
QTC_ASSERT(settings, return name);
|
||||
QString result = name;
|
||||
if (settings->group().isEmpty())
|
||||
result.prepend(QLatin1String("Designer"));
|
||||
|
||||
Reference in New Issue
Block a user