diff --git a/src/Settings/SettingsGroup.cc b/src/Settings/SettingsGroup.cc index 0e56bdfb408cf550d68a1c00d45cff1d81a57016..d93ed4c9feb9c4582ee6b9c7f9cdb5a94419ba97 100644 --- a/src/Settings/SettingsGroup.cc +++ b/src/Settings/SettingsGroup.cc @@ -11,19 +11,24 @@ #include "QGCCorePlugin.h" #include "QGCApplication.h" +static const char* kJsonFile = ":/json/%1.SettingsGroup.json"; + SettingsGroup::SettingsGroup(const QString& name, const QString& settingsGroup, QObject* parent) : QObject (parent) + , _visible (qgcApp()->toolbox()->corePlugin()->overrideSettingsGroupVisibility(name)) , _name (name) , _settingsGroup(settingsGroup) - , _visible (qgcApp()->toolbox()->corePlugin()->overrideSettingsGroupVisibility(_name)) { - QString jsonNameFormat(":/json/%1.SettingsGroup.json"); - - _nameToMetaDataMap = FactMetaData::createMapFromJsonFile(jsonNameFormat.arg(_name), this); + _nameToMetaDataMap = FactMetaData::createMapFromJsonFile(QString(kJsonFile).arg(name), this); } SettingsFact* SettingsGroup::_createSettingsFact(const QString& factName) { - return new SettingsFact(_settingsGroup, _nameToMetaDataMap[factName], this); + FactMetaData* m = _nameToMetaDataMap[factName]; + if(!m) { + qCritical() << "Fact name " << factName << "not found in" << QString(kJsonFile).arg(_name); + exit(-1); + } + return new SettingsFact(_settingsGroup, m, this); }