Ejemplo n.º 1
0
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();
}
Ejemplo n.º 2
0
void RackInspectorSection::on_slotRemoved(const SlotModel& slot)
{
    auto ptr = slotmodelsSectionWidgets[slot.id()];
    slotmodelsSectionWidgets.erase(slot.id());

    if(ptr)
    {
        ptr->deleteLater();
    }
}
Ejemplo n.º 3
0
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);
}
Ejemplo n.º 4
0
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));
    }
}
Ejemplo n.º 5
0
void RackInspectorSection::addSlotInspectorSection(const SlotModel& slot)
{
    SlotInspectorSection* newSlot = new SlotInspectorSection {
                                    slot.metadata.name(),
                                    slot,
                                    this};

    m_slotSection->addContent(newSlot);

    slotmodelsSectionWidgets[slot.id()] = newSlot;
}
Ejemplo n.º 6
0
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()));
}