| 85 | } |
| 86 | |
| 87 | void WidgetSettingList::Refresh(RefreshAreas refresh_areas) { |
| 88 | const SettingDependenceMode enabled = ::CheckDependence(this->meta, data_set); |
| 89 | |
| 90 | this->item->setHidden(enabled == SETTING_DEPENDENCE_HIDE); |
| 91 | this->item->setDisabled(enabled != SETTING_DEPENDENCE_ENABLE); |
| 92 | this->setEnabled(enabled == SETTING_DEPENDENCE_ENABLE); |
| 93 | this->field->setEnabled(enabled == SETTING_DEPENDENCE_ENABLE && (!this->meta.list_only || !this->list.empty())); |
| 94 | this->add_button->setEnabled(enabled == SETTING_DEPENDENCE_ENABLE && !this->field->text().isEmpty()); |
| 95 | |
| 96 | if (this->meta.list_only && this->list.empty()) { |
| 97 | this->field->hide(); |
| 98 | this->add_button->hide(); |
| 99 | } else { |
| 100 | this->field->show(); |
| 101 | this->add_button->show(); |
| 102 | } |
| 103 | |
| 104 | std::vector<EnabledNumberOrString> &value = this->data().value; |
| 105 | |
| 106 | if (value != this->value_cached) { |
| 107 | this->value_cached = value; |
| 108 | |
| 109 | this->tree->blockSignals(true); |
| 110 | |
| 111 | while (this->item->childCount() > 0) { |
| 112 | this->item->removeChild(this->item->child(0)); |
| 113 | } |
| 114 | |
| 115 | for (std::size_t i = 0, n = value.size(); i < n; ++i) { |
| 116 | this->AddElement(value[i]); |
| 117 | } |
| 118 | |
| 119 | this->tree->blockSignals(false); |
| 120 | } |
| 121 | |
| 122 | if (refresh_areas == REFRESH_ENABLE_AND_STATE) { |
| 123 | if (::CheckSettingOverridden(this->meta)) { |
| 124 | this->DisplayOverride(this->field, this->meta); |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | void WidgetSettingList::Resize() { |
| 130 | const int button_size = MIN_BUTTON_SIZE; |
no test coverage detected