| 74 | } |
| 75 | |
| 76 | void Scene2DConfigPanel::bindDock(SceneDockWidget* dock) { |
| 77 | if (dock_.data() == dock) { |
| 78 | return; |
| 79 | } |
| 80 | disconnectDock(); |
| 81 | dock_ = dock; |
| 82 | |
| 83 | list_->clearRows(); |
| 84 | config_host_->clear(); |
| 85 | |
| 86 | if (dock == nullptr) { |
| 87 | return; |
| 88 | } |
| 89 | |
| 90 | rebuildList(); |
| 91 | |
| 92 | connect(dock, &SceneDockWidget::layerAdded, this, [this](ObjectTopicId topic_id) { |
| 93 | if (dock_ == nullptr) { |
| 94 | return; |
| 95 | } |
| 96 | if (ISceneLayer* layer = dock_->layerFor(topic_id)) { |
| 97 | const auto info = layer->info(); |
| 98 | list_->addRow(LayerRow{info.topic_id.id, info.display_name, info.visible}); |
| 99 | } |
| 100 | updateConfigPane(); |
| 101 | }); |
| 102 | connect(dock, &SceneDockWidget::layerRemoved, this, [this](ObjectTopicId topic_id) { |
| 103 | list_->removeRow(topic_id.id); |
| 104 | updateConfigPane(); |
| 105 | }); |
| 106 | connect(dock, &SceneDockWidget::layerVisibilityChanged, this, [this](ObjectTopicId topic_id, bool visible) { |
| 107 | list_->setRowVisible(topic_id.id, visible); |
| 108 | }); |
| 109 | connect(dock, &SceneDockWidget::layerWarningChanged, this, [this](ObjectTopicId topic_id, bool warn, QString reason) { |
| 110 | list_->setRowWarning(topic_id.id, warn, reason); |
| 111 | }); |
| 112 | } |
| 113 | |
| 114 | void Scene2DConfigPanel::disconnectDock() { |
| 115 | if (dock_ != nullptr) { |
no test coverage detected