void RackPresenter::on_slotRemoved(const SlotModel& slot_model) { auto& slot = m_slots.at(slot_model.id()); m_slots.remove(slot_model.id()); delete &slot; on_askUpdate(); }
void RackInspectorSection::on_slotRemoved(const SlotModel& slot) { auto ptr = slotmodelsSectionWidgets[slot.id()]; slotmodelsSectionWidgets.erase(slot.id()); if(ptr) { ptr->deleteLater(); } }
SlotModel::SlotModel( std::function<void(const SlotModel&, SlotModel&)> lmCopyMethod, const SlotModel& source, const id_type<SlotModel>& id, RackModel *parent): IdentifiedObject<SlotModel> {id, "SlotModel", parent}, m_frontLayerModelId {source.frontLayerModel() }, // Keep the same id. m_height {source.height() } { lmCopyMethod(source, *this); }
void SlotModel::copyViewModelsInSameConstraint( const SlotModel &source, SlotModel &target) { for(LayerModel* lm : source.layerModels()) { // We can safely reuse the same id since it's in a different slot. auto& proc = lm->sharedProcessModel(); target.addLayerModel( proc.cloneLayer(lm->id(), *lm, &target)); } }
void RackInspectorSection::addSlotInspectorSection(const SlotModel& slot) { SlotInspectorSection* newSlot = new SlotInspectorSection { slot.metadata.name(), slot, this}; m_slotSection->addContent(newSlot); slotmodelsSectionWidgets[slot.id()] = newSlot; }
SlotModel::SlotModel( std::function<void(const SlotModel&, SlotModel&)> lmCopyMethod, const SlotModel& source, const Id<SlotModel>& id, RackModel *parent): IdentifiedObject<SlotModel> {id, Metadata<ObjectKey_k, SlotModel>::get(), parent}, m_frontLayerModelId{Id<Process::LayerModel>{source.m_frontLayerModelId.val()}}, m_height {source.height() } { initConnections(); lmCopyMethod(source, *this); // Note: we have a small trick for the layer model id. // Since we're cloning, we want the pointer cached in the layer model to be the // one we have cloned, hence instead of just copying the id, we ask the corresponding // layer model to give us its id. // TODO this is f*****g ugly - mostly because two objects exist with the same id... metadata = source.metadata; metadata.setName(QString{"Slot.%1"} .arg(*id.val())); }