void SystemsSettingsEditor::ShowDialog() { QPushButton * sender = dynamic_cast<QPushButton *>(QObject::sender()); DVASSERT(sender); QtPropertyDataDavaVariant* propertyToChange = buttonsMap[sender].property; STATE_FLAGS_MAP* propFlagsMap = buttonsMap[sender].flagsMap; DVASSERT(propertyToChange); DVASSERT(propFlagsMap); uint32 oldValue = ResolveMapToUint(*propFlagsMap); SettingsStateDialog dialog(propFlagsMap,this); dialog.exec(); if(dialog.result() != QDialog::Accepted ) { return; } uint32 newValue = ResolveMapToUint(*propFlagsMap); if(newValue == oldValue) { return; } propertyToChange->AddAllowedValue(DAVA::VariantType((int32)newValue), ResolveMapToString(*propFlagsMap).c_str()); propertyToChange->SetVariantValue(DAVA::VariantType((int32)newValue)); propertyToChange->SetValue(QVariant((int32)newValue)); }
void SystemsSettingsEditor::RestoreInitialSettings() { for (DAVA::List<PropertyInfo>::iterator it= propertiesMap.begin(); it != propertiesMap.end(); ++it) { QtPropertyDataDavaVariant* property = it->property; STATE_FLAGS_MAP * map = it->flagsMap; if(NULL != map) { InitMapWithFlag(map, it->defaultValue.toInt()); } this->model()->blockSignals(true); property->SetValue(it->defaultValue); this->model()->blockSignals(false); } }