| 30 | #include <cassert> |
| 31 | |
| 32 | WidgetSettingFilesystem::WidgetSettingFilesystem(QTreeWidget* tree, QTreeWidgetItem* item, const SettingMetaFilesystem& meta, |
| 33 | SettingDataSet& data_set) |
| 34 | : WidgetSettingBase(tree, item), |
| 35 | meta(meta), |
| 36 | data_set(data_set), |
| 37 | item_child(new QTreeWidgetItem()), |
| 38 | field(new QLineEdit(this)), |
| 39 | button(new QPushButton(this)), |
| 40 | timer(new QTimer(this)) { |
| 41 | this->field->show(); |
| 42 | this->connect(this->field, SIGNAL(textEdited(const QString&)), this, SLOT(textFieldChanged(const QString&))); |
| 43 | this->connect(this->field, SIGNAL(returnPressed()), this, SLOT(textFieldReturnPressed())); |
| 44 | this->connect(this->timer, SIGNAL(timeout()), this, SLOT(textFieldReturnPressed())); |
| 45 | |
| 46 | this->timer->setSingleShot(true); |
| 47 | |
| 48 | this->button->setText("..."); |
| 49 | this->button->show(); |
| 50 | this->connect(this->button, SIGNAL(clicked()), this, SLOT(browseButtonClicked())); |
| 51 | |
| 52 | this->item->setText(0, GetLabel(this->meta).c_str()); |
| 53 | this->item->setToolTip(0, meta.description.c_str()); |
| 54 | this->item->setSizeHint(0, QSize(0, ITEM_HEIGHT)); |
| 55 | this->item->addChild(item_child); |
| 56 | tree->setItemWidget(this->item, 0, this); |
| 57 | |
| 58 | this->item_child->setSizeHint(0, QSize(0, ITEM_HEIGHT)); |
| 59 | this->item_child->setExpanded(true); |
| 60 | tree->setItemWidget(this->item_child, 0, this->field); |
| 61 | |
| 62 | this->Refresh(REFRESH_ENABLE_AND_STATE); |
| 63 | } |
| 64 | |
| 65 | void WidgetSettingFilesystem::Refresh(RefreshAreas refresh_areas) { |
| 66 | const SettingDependenceMode enabled = ::CheckDependence(this->meta, data_set); |