Esempio n. 1
0
DocumentPlugin::DocumentPlugin(
            iscore::Document& doc,
            QObject* parent):
    iscore::DocumentPlugin{doc, "OSSIADocumentPlugin", parent},
    m_ctx{doc.context(),
          *this,
          doc.context().plugin<Explorer::DeviceDocumentPlugin>(),
          doc.context().app.components.factory<ProcessComponentFactoryList>(),
          doc.context().app.components.factory<StateProcessComponentFactoryList>(),
          }
{
    con(doc, &iscore::Document::aboutToClose,
        this, [&]
    {
        if(m_base)
        {
            m_base->baseConstraint()->stop();
        }
        m_base.reset();
    });
}
void ApplicationPlugin::on_createdDocument(iscore::Document& doc)
{
    doc.model().addPluginModel(new DocumentPlugin{m_ctx, doc, getStrongId(doc.model().pluginModels()), &doc.model()});
}
Esempio n. 3
0
EventInspectorWidget::EventInspectorWidget(
        const EventModel& object,
        iscore::Document& doc,
        QWidget* parent) :
    InspectorWidgetBase {object, doc, parent},
    m_model {object}
{
    setObjectName("EventInspectorWidget");
    setParent(parent);

    con(m_model, &EventModel::statesChanged,
            this,    &EventInspectorWidget::updateDisplayedValues);
    con(m_model, &EventModel::dateChanged,
            this,   &EventInspectorWidget::modelDateChanged);

    ////// HEADER
    // metadata
    m_metadata = new MetadataWidget{&m_model.metadata, commandDispatcher(), &m_model, this};
    m_metadata->setType(EventModel::prettyName());
    m_metadata->setupConnections(m_model);

    addHeader(m_metadata);

    ////// BODY
    /// Information
    auto infoWidg = new QWidget;
    auto infoLay = new iscore::MarginLess<QFormLayout>;
    infoWidg->setLayout(infoLay);

    // timeNode
    auto timeNode = m_model.timeNode();
    if(timeNode)
    {
        auto scenar = m_model.parentScenario();
        auto tnBtn = SelectionButton::make(
                    tr("Parent TimeNode"),
                    &scenar->timeNode(timeNode),
                    selectionDispatcher(),
                    this);

        infoLay->addWidget(tnBtn);
    }

    // date
    auto datewidg = new QWidget;
    auto dateLay = new iscore::MarginLess<QHBoxLayout>;
    datewidg->setLayout(dateLay);
    m_date = new QLabel{(m_model.date().toString())};

    dateLay->addWidget(new QLabel(tr("Default date")));
    dateLay->addWidget(m_date);

    infoLay->addWidget(datewidg);
    m_properties.push_back(infoWidg);

    // Trigger
    auto& tn = m_model.parentScenario()->timeNode(m_model.timeNode());
    m_triggerWidg = new TriggerInspectorWidget{tn, this};
    m_properties.push_back(new QLabel{tr("Trigger")});
    m_properties.push_back(m_triggerWidg);

    // Separator
    m_properties.push_back(new Separator {this});

    // Condition
    m_conditionLineEdit = new QLineEdit{this};
    m_conditionLineEdit->setValidator(&m_validator);

    connect(m_conditionLineEdit, &QLineEdit::editingFinished,
            this, &EventInspectorWidget::on_conditionChanged);
    con(m_model, &EventModel::conditionChanged,
        this, [this] (const iscore::Condition& c) {
        m_conditionLineEdit->setText(c.toString());
    });

    m_properties.push_back(new QLabel{tr("Condition")});
    m_properties.push_back(m_conditionLineEdit);

    // State
    m_properties.push_back(new Separator {this});
    m_statesWidget = new QWidget{this};
    auto dispLayout = new QVBoxLayout{m_statesWidget};
    m_statesWidget->setLayout(dispLayout);

    m_properties.push_back(new QLabel{"States"});
    m_properties.push_back(m_statesWidget);

    // Separator
    m_properties.push_back(new Separator {this});

    // Plugins (TODO factorize with ConstraintInspectorWidget)
    for(auto& plugdata : m_model.pluginModelList.list())
    {
        for(iscore::DocumentDelegatePluginModel* plugin : doc.model().pluginModels())
        {
            auto md = plugin->makeElementPluginWidget(plugdata, this);
            if(md)
            {
                m_properties.push_back(md);
                break;
            }
        }
    }

    updateDisplayedValues();


    // Display data
    updateAreaLayout(m_properties);
}