| 42 | } |
| 43 | |
| 44 | WidgetSettingFlag::WidgetSettingFlag(QTreeWidget* tree, QTreeWidgetItem* item, const SettingMetaFlags& meta, |
| 45 | SettingDataSet& data_set, const std::string& flag) |
| 46 | : WidgetSettingBase(tree, item), meta(meta), data_set(data_set), flag(flag), field(new QCheckBox(this)) { |
| 47 | assert(!flag.empty()); |
| 48 | |
| 49 | const SettingEnumValue* enum_value = FindByKey(meta.enum_values, flag.c_str()); |
| 50 | assert(enum_value); |
| 51 | |
| 52 | const std::string status = enum_value->status == STATUS_STABLE ? "" : std::string(" (") + GetToken(enum_value->status) + ")"; |
| 53 | |
| 54 | this->field->setText((enum_value->label + status).c_str()); |
| 55 | this->field->setFont(tree->font()); |
| 56 | this->field->show(); |
| 57 | this->connect(this->field, SIGNAL(clicked(bool)), this, SLOT(OnClicked(bool))); |
| 58 | |
| 59 | this->item->setSizeHint(0, QSize(0, ITEM_HEIGHT)); |
| 60 | this->tree->setItemWidget(this->item, 0, this); |
| 61 | |
| 62 | this->Refresh(REFRESH_ENABLE_AND_STATE); |
| 63 | } |
| 64 | |
| 65 | void WidgetSettingFlag::Refresh(RefreshAreas refresh_areas) { |
| 66 | const SettingDependenceMode enabled = ::CheckDependence(this->meta, data_set); |