| 253 | } |
| 254 | |
| 255 | void SettingsTreeManager::BuildTreeItem(QTreeWidgetItem *parent, const SettingMeta &meta_object) { |
| 256 | if (!IsPlatformSupported(meta_object.platform_flags)) { |
| 257 | return; |
| 258 | } |
| 259 | |
| 260 | Configurator &configurator = Configurator::Get(); |
| 261 | if (configurator.GetUseLayerDebugMode()) { |
| 262 | if (meta_object.view == SETTING_VIEW_HIDDEN) { |
| 263 | return; |
| 264 | } |
| 265 | } else { |
| 266 | if (meta_object.view != SETTING_VIEW_STANDARD) { |
| 267 | return; |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | Parameter *parameter = configurator.GetActiveParameter(); |
| 272 | assert(parameter != nullptr); |
| 273 | |
| 274 | QTreeWidgetItem *item = new TreeItem(meta_object.key); |
| 275 | item->setSizeHint(0, QSize(0, ITEM_HEIGHT)); |
| 276 | if (parent == nullptr) { |
| 277 | this->ui->configurations_settings->addTopLevelItem(item); |
| 278 | } else { |
| 279 | parent->addChild(item); |
| 280 | } |
| 281 | item->setExpanded(parameter->GetExpanded(meta_object.key.c_str())); |
| 282 | |
| 283 | const SettingDependenceMode enabled = ::CheckDependence(meta_object, parameter->settings); |
| 284 | item->setHidden(enabled == SETTING_DEPENDENCE_HIDE); |
| 285 | item->setDisabled(enabled != SETTING_DEPENDENCE_ENABLE); |
| 286 | |
| 287 | switch (meta_object.type) { |
| 288 | case SETTING_GROUP: { |
| 289 | const SettingMetaGroup &meta = static_cast<const SettingMetaGroup &>(meta_object); |
| 290 | |
| 291 | WidgetSettingGroup *widget = new WidgetSettingGroup(this->ui->configurations_settings, item, meta, parameter->settings); |
| 292 | (void)widget; |
| 293 | } break; |
| 294 | case SETTING_BOOL: |
| 295 | case SETTING_BOOL_NUMERIC_DEPRECATED: { |
| 296 | const SettingMetaBool &meta = static_cast<const SettingMetaBool &>(meta_object); |
| 297 | |
| 298 | WidgetSettingBool *widget = new WidgetSettingBool(this->ui->configurations_settings, item, meta, parameter->settings); |
| 299 | this->connect(widget, SIGNAL(refreshEnableOnly()), this, SLOT(OnRefreshEnableOnly())); |
| 300 | } break; |
| 301 | |
| 302 | case SETTING_INT: { |
| 303 | const SettingMetaInt &meta = static_cast<const SettingMetaInt &>(meta_object); |
| 304 | |
| 305 | WidgetSettingInt *widget = new WidgetSettingInt(this->ui->configurations_settings, item, meta, parameter->settings); |
| 306 | this->connect(widget, SIGNAL(refreshEnableOnly()), this, SLOT(OnRefreshEnableOnly())); |
| 307 | } break; |
| 308 | |
| 309 | case SETTING_FLOAT: { |
| 310 | const SettingMetaFloat &meta = static_cast<const SettingMetaFloat &>(meta_object); |
| 311 | |
| 312 | WidgetSettingFloat *widget = new WidgetSettingFloat(this->ui->configurations_settings, item, meta, parameter->settings); |
no test coverage detected